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

Method item

basex-core/src/main/java/org/basex/query/func/bin/BinPart.java:17–29  ·  view source on GitHub ↗
(final QueryContext qc, final InputInfo ii)

Source from the content-addressed store, hash-verified

15 */
16public final class BinPart extends BinFn {
17 @Override
18 public Item item(final QueryContext qc, final InputInfo ii) throws QueryException {
19 final Bin value = toBinOrNull(arg(0), qc);
20 final long offset = toLong(arg(1), qc);
21 final Long size = toLongOrNull(arg(2), qc);
22 if(value == null) return Empty.VALUE;
23
24 final byte[] bytes = value.binary(info);
25 final int[] bounds = bounds(offset, size, bytes.length);
26
27 final int o = bounds[0], tl = bounds[1];
28 return B64.get(Arrays.copyOfRange(bytes, o, o + tl));
29 }
30}

Callers

nothing calls this directly

Calls 7

binaryMethod · 0.95
getMethod · 0.95
toBinOrNullMethod · 0.80
toLongOrNullMethod · 0.80
boundsMethod · 0.80
argMethod · 0.45
toLongMethod · 0.45

Tested by

no test coverage detected