| Methods |
| static StringBuilder |
appendMap(StringBuilder buff, HashMap map)
Append a map to the string builder, sorted by key.
|
| static StringBuilder |
appendMap(StringBuilder buff, HashMap map)
Append a map to the string builder, sorted by key.
Parameters:
buff - the target buffer
map - the map
Returns:
the string builder
|
| static void |
appendMap(StringBuilder buff, String key, String value)
Append a key-value pair to the string builder.
|
| static void |
appendMap(StringBuilder buff, String key, String value)
Append a key-value pair to the string builder. Keys may not contain a
colon. Values that contain a comma or a double quote are enclosed in
double quotes, with special characters escaped using a backslash.
Parameters:
buff - the target buffer
key - the key
value - the value
|
| static void |
appendMap(StringBuilder buff, String key, long value)
Append a key-value pair to the string builder.
|
| static void |
appendMap(StringBuilder buff, String key, long value)
Append a key-value pair to the string builder. Keys may not contain a
colon.
Parameters:
buff - the target buffer
key - the key
value - the value
|
| static void |
appendMap(StringBuilder buff, String key, int value)
Append a key-value pair to the string builder.
|
| static void |
appendMap(StringBuilder buff, String key, int value)
Append a key-value pair to the string builder. Keys may not contain a
colon.
Parameters:
buff - the target buffer
key - the key
value - the value
|
| static void |
checkArgument(boolean test, String message, Object... arguments)
Throw an IllegalArgumentException if the argument is invalid.
|
| static void |
checkArgument(boolean test, String message, Object... arguments)
Throw an IllegalArgumentException if the argument is invalid.
Parameters:
test - true if the argument is valid
message - the message
arguments - the arguments
Throws:
IllegalArgumentException - if the argument is invalid
|
| static void |
copyExcept(Object src, Object dst, int oldSize, int removeIndex)
Copy the elements of an array, and remove one element.
|
| static void |
copyExcept(Object src, Object dst, int oldSize, int removeIndex)
Copy the elements of an array, and remove one element.
Parameters:
src - the source array
dst - the target array
oldSize - the size of the old array
removeIndex - the index of the entry to remove
|
| static void |
copyWithGap(Object src, Object dst, int oldSize, int gapIndex)
Copy the elements of an array, with a gap.
|
| static void |
copyWithGap(Object src, Object dst, int oldSize, int gapIndex)
Copy the elements of an array, with a gap.
Parameters:
src - the source array
dst - the target array
oldSize - the size of the old array
gapIndex - the index of the gap
|
| static int |
encodeLength(int len)
Convert the length to a length code 0..31.
|
| static int |
encodeLength(int len)
Convert the length to a length code 0..31. 31 means more than 1 MB.
Parameters:
len - the length
Returns:
the length code
|
| static String |
formatMessage(int errorCode, String message, Object... arguments)
Format an error message.
|
| static String |
formatMessage(int errorCode, String message, Object... arguments)
Format an error message.
Parameters:
errorCode - the error code
message - the message
arguments - the arguments
Returns:
the formatted message
|
| static short |
getCheckValue(int x)
Calculate a check value for the given integer.
|
| static short |
getCheckValue(int x)
Calculate a check value for the given integer. A check value is mean to
verify the data is consistent with a high probability, but not meant to
protect against media failure or deliberate changes.
Parameters:
x - the value
Returns:
the check value
|
| static int |
getConfigParam(Map config, String key, int defaultValue)
Get the configuration parameter value, or default.
|
| static int |
getConfigParam(Map config, String key, int defaultValue)
Get the configuration parameter value, or default.
Parameters:
config - the configuration
key - the key
defaultValue - the default
Returns:
the configured value or default
|
| static int |
getErrorCode(String m)
Get the error code from an exception message.
|
| static int |
getErrorCode(String m)
Get the error code from an exception message.
Parameters:
m - the message
Returns:
the error code, or 0 if none
|
| static int |
getFletcher32(byte[] bytes, int offset, int length)
Calculate the Fletcher32 checksum.
|
| static int |
getFletcher32(byte[] bytes, int offset, int length)
Calculate the Fletcher32 checksum.
Parameters:
bytes - the bytes
offset - initial offset
length - the message length (if odd, 0 is appended)
Returns:
the checksum
|
| static String |
getFromMap(String s, String key)
Parse a specified pair from key-value pair list.
|
| static String |
getFromMap(String s, String key)
Parse a specified pair from key-value pair list.
Parameters:
s - the list
key - the name of the key
Returns:
value of the specified item, or {@code null}
Throws:
IllegalStateException - if parsing failed
|
| static String |
getMapName(String s)
Parse a name from key-value pair list.
|
| static String |
getMapName(String s)
Parse a name from key-value pair list.
Parameters:
s - the list
Returns:
value of name item, or {@code null}
Throws:
IllegalStateException - if parsing failed
|
| static int |
getPageChunkId(long pos)
Get the chunk id from the position.
|
| static int |
getPageChunkId(long pos)
Get the chunk id from the position.
Parameters:
pos - the position
Returns:
the chunk id
|
| static int |
getPageMaxLength(long pos)
Get the maximum length for the given code.
|
| static int |
getPageMaxLength(long pos)
Get the maximum length for the given code.
For the code 31, PAGE_LARGE is returned.
Parameters:
pos - the position
Returns:
the maximum length
|
| static int |
getPageOffset(long pos)
Get the offset from the position.
|
| static int |
getPageOffset(long pos)
Get the offset from the position.
Parameters:
pos - the position
Returns:
the offset
|
| static long |
getPagePos(int chunkId, int offset, int length, int type)
Get the position of this page.
|
| static long |
getPagePos(int chunkId, int offset, int length, int type)
Get the position of this page. The following information is encoded in
the position: the chunk id, the offset, the maximum length, and the type
(node or leaf).
Parameters:
chunkId - the chunk id
offset - the offset
length - the length
type - the page type (1 for node, 0 for leaf)
Returns:
the position
|
| static int |
getPageType(long pos)
Get the page type from the position.
|
| static int |
getPageType(long pos)
Get the page type from the position.
Parameters:
pos - the position
Returns:
the page type (PAGE_TYPE_NODE or PAGE_TYPE_LEAF)
|
| static int |
getVarIntLen(int x)
Get the length of the variable size int.
|
| static int |
getVarIntLen(int x)
Get the length of the variable size int.
Parameters:
x - the value
Returns:
the length in bytes
|
| static int |
getVarLongLen(long x)
Get the length of the variable size long.
|
| static int |
getVarLongLen(long x)
Get the length of the variable size long.
Parameters:
x - the value
Returns:
the length in bytes
|
| static IllegalArgumentException |
newIllegalArgumentException(String message, Object... arguments)
Create a new IllegalArgumentException.
|
| static IllegalArgumentException |
newIllegalArgumentException(String message, Object... arguments)
Create a new IllegalArgumentException.
Parameters:
message - the message
arguments - the arguments
Returns:
the exception
|
| static IllegalStateException |
newIllegalStateException(int errorCode, String message, Object... arguments)
Create a new IllegalStateException.
|
| static IllegalStateException |
newIllegalStateException(int errorCode, String message, Object... arguments)
Create a new IllegalStateException.
Parameters:
errorCode - the error code
message - the message
arguments - the arguments
Returns:
the exception
|
| static UnsupportedOperationException |
newUnsupportedOperationException(String message)
Create a new UnsupportedOperationException.
|
| static UnsupportedOperationException |
newUnsupportedOperationException(String message)
Create a new UnsupportedOperationException.
Parameters:
message - the message
Returns:
the exception
|
| static HashMap |
parseChecksummedMap(byte[] bytes)
Parse a key-value pair list and checks its checksum.
|
| static HashMap |
parseChecksummedMap(byte[] bytes)
Parse a key-value pair list and checks its checksum.
Parameters:
bytes - encoded map
Returns:
the map without mapping for {@code "fletcher"}, or {@code null} if checksum is wrong
Throws:
IllegalStateException - if parsing failed
|
| static int |
parseHexInt(String x)
Parse an unsigned, hex long.
|
| static int |
parseHexInt(String x)
Parse an unsigned, hex long.
Parameters:
x - the string
Returns:
the parsed value
Throws:
IllegalStateException - if parsing fails
|
| static long |
parseHexLong(String x)
Parse an unsigned, hex long.
|
| static long |
parseHexLong(String x)
Parse an unsigned, hex long.
Parameters:
x - the string
Returns:
the parsed value
Throws:
IllegalStateException - if parsing fails
|
| static HashMap |
parseMap(String s)
Parse a key-value pair list.
|
| static HashMap |
parseMap(String s)
Parse a key-value pair list.
Parameters:
s - the list
Returns:
the map
Throws:
IllegalStateException - if parsing failed
|
| static void |
readFully(FileChannel file, long pos, ByteBuffer dst)
Read from a file channel until the buffer is full.
|
| static void |
readFully(FileChannel file, long pos, ByteBuffer dst)
Read from a file channel until the buffer is full.
The buffer is rewind after reading.
Parameters:
file - the file channel
pos - the absolute position within the file
dst - the byte buffer
Throws:
IllegalStateException - if some data could not be read
|
| static int |
readHexInt(HashMap map, String key, int defaultValue)
Read a hex int value from a map.
|
| static int |
readHexInt(HashMap map, String key, int defaultValue)
Read a hex int value from a map.
Parameters:
map - the map
key - the key
defaultValue - if the value is null
Returns:
the parsed value
Throws:
IllegalStateException - if parsing fails
|
| static long |
readHexLong(Map map, String key, long defaultValue)
Read a hex long value from a map.
|
| static long |
readHexLong(Map map, String key, long defaultValue)
Read a hex long value from a map.
Parameters:
map - the map
key - the key
defaultValue - if the value is null
Returns:
the parsed value
Throws:
IllegalStateException - if parsing fails
|
| static String |
readString(ByteBuffer buff, int len)
Read a string.
|
| static String |
readString(ByteBuffer buff, int len)
Read a string.
Parameters:
buff - the source buffer
len - the number of characters
Returns:
the value
|
| static int |
readVarInt(ByteBuffer buff)
Read a variable size int.
|
| static int |
readVarInt(ByteBuffer buff)
Read a variable size int.
Parameters:
buff - the source buffer
Returns:
the value
|
| static long |
readVarLong(ByteBuffer buff)
Read a variable size long.
|
| static long |
readVarLong(ByteBuffer buff)
Read a variable size long.
Parameters:
buff - the source buffer
Returns:
the value
|
| static void |
writeFully(FileChannel file, long pos, ByteBuffer src)
Write to a file channel.
|
| static void |
writeFully(FileChannel file, long pos, ByteBuffer src)
Write to a file channel.
Parameters:
file - the file channel
pos - the absolute position within the file
src - the source buffer
|
| static void |
writeStringData(ByteBuffer buff, String s, int len)
Write characters from a string (without the length).
|
| static void |
writeStringData(ByteBuffer buff, String s, int len)
Write characters from a string (without the length).
Parameters:
buff - the target buffer (must be large enough)
s - the string
len - the number of characters
|
| static void |
writeVarInt(OutputStream out, int x)
Write a variable size int.
|
| static void |
writeVarInt(OutputStream out, int x) throws IOException
Write a variable size int.
Parameters:
out - the output stream
x - the value
|
| static void |
writeVarInt(ByteBuffer buff, int x)
Write a variable size int.
|
| static void |
writeVarInt(ByteBuffer buff, int x)
Write a variable size int.
Parameters:
buff - the source buffer
x - the value
|
| static void |
writeVarLong(ByteBuffer buff, long x)
Write a variable size long.
|
| static void |
writeVarLong(ByteBuffer buff, long x)
Write a variable size long.
Parameters:
buff - the target buffer
x - the value
|
| static void |
writeVarLong(OutputStream out, long x)
Write a variable size long.
|
| static void |
writeVarLong(OutputStream out, long x) throws IOException
Write a variable size long.
Parameters:
out - the output stream
x - the value
|
The type for leaf page.
An error occurred while reading from the file.
The type for node page.
The maximum length of a variable size long.
The transaction store is corrupt.
An entry is still locked by another transaction.
There are too many open transactions.
The transaction store is in an illegal state (for example, not yet
initialized).
The estimated number of bytes used per page object.
The estimated number of bytes used per child entry.
An error occurred when trying to write to the file.
The bit mask for compressed pages (compression level fast).
The maximum integer that needs less space when using variable size
encoding (only 3 bytes instead of 4).
The marker size of a very large page.
An internal error occurred. This could be a bug, or a memory corruption
(for example caused by out of memory).
The object is already closed.
The file format is not supported.
The maximum length of a variable size int.
The block in the stream store was not found.
The maximum long that needs less space when using variable size
encoding (only 7 bytes instead of 8).
The file is corrupt or (for encrypted files) the encryption key is wrong.
The bit mask for compressed pages (compression level high).
The file is locked.
An error occurred when serializing or de-serializing.
The application was trying to read data from a chunk that is no longer
available.