Package org.basex.util
Class Inline
- java.lang.Object
-
- org.basex.util.Inline
-
public final class Inline extends Object
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
XML 1.0 whitespaces will be represented as follows:DiskData
. - Byte 4: integer value or inlined whitespace token- 00: 0x0A (new line) - 01: 0x09 (tabulator) - 10: 0x20 (space) - 11: 0x0D (carriage return)
- Author:
- BaseX Team 2005-23, BSD License, Christian Gruen
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
inlined(long value)
Indicates if the specified value is inlined.static long
pack(byte[] token)
Creates a numeric (inlined) representation of the specified token.static long
packInt(byte[] token)
Converts the specified token into a positive integer value.static byte[]
unpack(long value)
Converts an inlined value to a token.static double
unpackDouble(long value)
Converts an inlined value to a double value.static int
unpackLength(long value)
Returns the token length of the inlined value.static long
unpackLong(long value)
Converts an inlined value to a long value.
-
-
-
Method Detail
-
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
0
if 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
-1
if 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
-
-