MCPcopy Create free account
hub / github.com/BaseXdb/basex / get

Method get

basex-core/src/main/java/org/basex/util/Num.java:80–91  ·  view source on GitHub ↗

Decompresses and returns a value from the specified byte array. @param array array @param pos position where the value is found @return decompressed value

(final byte[] array, final int pos)

Source from the content-addressed store, hash-verified

78 * @return decompressed value
79 */
80 public static int get(final byte[] array, final int pos) {
81 int p = pos;
82 final int v = array[p++] & 0xFF;
83 return switch((v & 0xC0) >>> 6) {
84 case 0 -> v;
85 case 1 -> (v & 0x3F) << 8 | array[p] & 0xFF;
86 case 2 -> (v & 0x3F) << 24 | (array[p++] & 0xFF) << 16 |
87 (array[p++] & 0xFF) << 8 | array[p] & 0xFF;
88 default -> (array[p++] & 0xFF) << 24 | (array[p++] & 0xFF) << 16 |
89 (array[p++] & 0xFF) << 8 | array[p] & 0xFF;
90 };
91 }
92
93 /**
94 * Compresses and stores an integer value at the beginning of the byte array.

Callers 4

mergeMethod · 0.95
writeIndexMethod · 0.95
toStringMethod · 0.95
unpackMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected