Package org.basex.util
Class Inline
java.lang.Object
org.basex.util.Inline
This class converts tokens to a numeric value. The bytes of the inlined values are composed
as follows:
- Byte 0-2: unused
- Byte 3: see bit layout in DiskData.
- Byte 4: integer value or inlined whitespace token
XML 1.0 whitespaces will be represented as follows:
- 00: 0x0A (new line) - 01: 0x09 (tabulator) - 10: 0x20 (space) - 11: 0x0D (carriage return)
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleaninlined(long value) Indicates if the specified value is inlined.static longpack(byte[] token) Creates a numeric (inlined) representation of the specified token.static longpackInt(byte[] token) Converts the specified token into a positive integer value.static byte[]unpack(long value) Converts an inlined value to a token.static doubleunpackDouble(long value) Converts an inlined value to a double value.static intunpackLength(long value) Returns the token length of the inlined value.static longunpackLong(long value) Converts an inlined value to a long value.
-
Method Details
-
pack
public static long pack(byte[] token) Creates a numeric (inlined) representation of the specified token.- Parameters:
token- token to be inlined- Returns:
- inlined value, or
0if inlining is not possible
-
packInt
public static long packInt(byte[] token) Converts the specified token into a positive integer value.- Parameters:
token- token to be converted- Returns:
- inlined value, or
-1if value cannot be inlined
-
unpack
public static byte[] unpack(long value) Converts an inlined value to a token.- Parameters:
value- inlined value- Returns:
- unpacked token
-
unpackLong
public static long unpackLong(long value) Converts an inlined value to a long value.- Parameters:
value- inlined value- Returns:
- unpacked integer
-
unpackDouble
public static double unpackDouble(long value) Converts an inlined value to a double value.- Parameters:
value- inlined value- Returns:
- unpacked double
-
unpackLength
public static int unpackLength(long value) Returns the token length of the inlined value.- Parameters:
value- inlined value- Returns:
- length of unpacked token
-
inlined
public static boolean inlined(long value) Indicates if the specified value is inlined.- Parameters:
value- value- Returns:
- result of check
-