| Modifier and Type | Field and Description |
|---|---|
| public static final int | COMPRESSED_VAR_INT_MAX
The maximum integer that needs less space when using variable size encoding (only 3 bytes instead of 4). |
| public static final long | COMPRESSED_VAR_LONG_MAX
The maximum long that needs less space when using variable size encoding (only 7 bytes instead of 8). |
| public static final int | ERROR_BLOCK_NOT_FOUND
The block in the stream store was not found. |
| public static final int | ERROR_CHUNK_NOT_FOUND
The application was trying to read data from a chunk that is no longer available. |
| public static final int | ERROR_CLOSED
The object is already closed. |
| public static final int | ERROR_FILE_CORRUPT
The file is corrupt or (for encrypted files) the encryption key is wrong. |
| public static final int | ERROR_FILE_LOCKED
The file is locked. |
| public static final int | ERROR_INTERNAL
An internal error occurred. |
| public static final int | ERROR_READING_FAILED
An error occurred while reading from the file. |
| public static final int | ERROR_SERIALIZATION
An error occurred when serializing or de-serializing. |
| public static final int | ERROR_TOO_MANY_OPEN_TRANSACTIONS
There are too many open transactions. |
| public static final int | ERROR_TRANSACTION_CORRUPT
The transaction store is corrupt. |
| public static final int | ERROR_TRANSACTION_ILLEGAL_STATE
The transaction store is in an illegal state (for example, not yet initialized). |
| public static final int | ERROR_TRANSACTION_LOCKED
An entry is still locked by another transaction. |
| public static final int | ERROR_TRANSACTION_TOO_BIG
The transaction contains too many changes. |
| public static final int | ERROR_TRANSACTIONS_DEADLOCK
Deadlock discovered and one of transactions involved chosen as victim and rolled back. |
| public static final int | ERROR_UNKNOWN_DATA_TYPE
The transaction store can not be initialized because data type is not found in type registry. |
| public static final int | ERROR_UNSUPPORTED_FORMAT
The file format is not supported. |
| public static final int | ERROR_WRITING_FAILED
An error occurred when trying to write to the file. |
| public static final String | META_CHUNK
The prefix for chunks ("chunk."). |
| public static final String | META_MAP
The prefix for maps ("map."). |
| public static final String | META_NAME
The prefix for names ("name."). |
| public static final String | META_ROOT
The prefix for root positions of maps ("root."). |
| public static final int | PAGE_COMPRESSED
The bit mask for compressed pages (compression level fast). |
| public static final int | PAGE_COMPRESSED_HIGH
The bit mask for compressed pages (compression level high). |
| public static final int | PAGE_LARGE
The marker size of a very large page. |
| public static final int | PAGE_TYPE_LEAF
The type for leaf page. |
| public static final int | PAGE_TYPE_NODE
The type for node page. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public static StringBuilder | Returns: the string builderthe target buffer buff, HashMap<String, ?> the map map)Append a map to the string builder, sorted by key. |
| public static void | appendMap(StringBuilder
the target buffer buff, String the key key, String the value value)Append a key-value pair to the string builder. |
| public static void | appendMap(StringBuilder
the target buffer buff, String the key key, long the value value)Append a key-value pair to the string builder. |
| public static void | appendMap(StringBuilder
the target buffer buff, String the key key, int the value value)Append a key-value pair to the string builder. |
| private static StringBuilder | |
| public static void | checkArgument(boolean
true if the argument is valid test, String the message message, Object... the arguments arguments)Throw an IllegalArgumentException if the argument is invalid. |
| public static long | Returns: the positionthe chunk id chunkId, int the offset offset, int the length length, int the page type (1 for node, 0 for leaf) type)Get the position of this page. |
| public static long | Returns: the page positionthe chunk id chunkId, long the element tocElement)Convert tocElement into pagePos by replacing mapId with chunkId. |
| public static long | Returns: the positionthe chunk id mapId, int the offset offset, int the length length, int the page type (1 for node, 0 for leaf) type)Create table of content element. |
| public static IOException | Returns: the IO exceptionthe root cause e)Convert an exception to an IO exception. |
| public static void | copyExcept(Object
the source array src, Object the target array dst, int the size of the old array oldSize, int the index of the entry to remove removeIndex)Copy the elements of an array, and remove one element. |
| public static void | copyWithGap(Object
the source array src, Object the target array dst, int the size of the old array oldSize, int the index of the gap gapIndex)Copy the elements of an array, with a gap. |
| public static int | Returns: the maximum lengthencoded page length code)Get the maximum length for the given code. |
| public static int | |
| public static String | Returns: the formatted messagethe error code errorCode, String the message message, Object... the arguments arguments)Format an error message. |
| public static short | |
| pack-priv static int | Returns: the configured value or defaultthe configuration config, String the key key, int the default defaultValue)Get the configuration parameter value, or default. |
| public static int | Returns: the checksumthe bytes bytes, int initial offset offset, int the message length (if odd, 0 is appended) length)Calculate the Fletcher32 checksum. |
| public static String | Returns: value of the specified item, ornullthe list s, String the name of the key key)Parse a specified pair from key-value pair list. |
| public static String | Returns: value of name item, ornullthe list s)Parse a name from key-value pair list. |
| public static int | |
| public static int | Returns: the map idpacked table of content element tocElement)Get the map id from the chunk's table of content element. |
| public static int | Returns: the maximum lengththe position pos)Get the maximum length for the given page position. |
| public static int | Returns: the offsetpacked table of content element tocElement)Get the offset from the position. |
| public static int | Returns: the page type (PAGE_TYPE_NODE or PAGE_TYPE_LEAF)the position pos)Get the page type from the position. |
| public static int | |
| public static int | |
| private static <T extends Exception> T | |
| public static boolean | Returns: true if it is a leaf, false otherwisethe position pos)Determines whether specified file position corresponds to a leaf page |
| pack-priv static boolean | Returns: true if page has been removed (no longer accessible from the current root of the tree)the position pos)Find out if page was removed. |
| public static boolean | |
| public static IllegalArgumentException | Returns: the exceptionthe message message, Object... the arguments arguments)Create a new IllegalArgumentException. |
| public static MVStoreException | Returns: the exceptionthe error code errorCode, String the message message, Object... the arguments arguments)Create a new MVStoreException. |
| public static UnsupportedOperationException | Returns: the exceptionthe message message)Create a new UnsupportedOperationException. |
| pack-priv static HashMap | Returns: the map without mapping for"fletcher", or null if checksum is wrong
or parameter do not represent a properly formatted map serializationencoded map bytes)Parse a key-value pair list and checks its checksum. |
| pack-priv static byte[] | Returns: the byte array, or null if not in the mapthe map map, String the key key)Parse the hex-encoded bytes of an entry in the map. |
| public static int | |
| public static long | |
| public static HashMap | |
| private static int | Returns: new offsetoutput buffer, should be empty buff, String parsed string s, int offset to parse from i, int stop offset (exclusive) size)
|
| public static void | readFully(FileChannel
the file channel file, long the absolute position within the file pos, ByteBuffer the byte buffer dst)Read from a file channel until the buffer is full. |
| pack-priv static int | Returns: the parsed valuethe map map, String the key key, int if the value is null defaultValue)Read a hex int value from a map. |
| public static long | Returns: the parsed valuethe map map, String the key key, long if the value is null defaultValue)Read a hex long value from a map. |
| public static String | |
| public static String | Returns: the valuethe source buffer buff, int the number of characters len)Read a string. |
| public static int | |
| private static int | |
| public static long | |
| public static void | writeFully(FileChannel
the file channel file, long the absolute position within the file pos, ByteBuffer the source buffer src)Write to a file channel. |
| public static void | writeStringData(ByteBuffer
the target buffer (must be large enough) buff, String the string s, int the number of characters len)Write characters from a string (without the length). |
| public static void | |
| public static void | |
| public static void | |
| public static void |
| COMPRESSED_VAR_INT_MAX | back to summary |
|---|---|
| public static final int COMPRESSED_VAR_INT_MAX The maximum integer that needs less space when using variable size encoding (only 3 bytes instead of 4). | |
| COMPRESSED_VAR_LONG_MAX | back to summary |
|---|---|
| public static final long COMPRESSED_VAR_LONG_MAX The maximum long that needs less space when using variable size encoding (only 7 bytes instead of 8). | |
| ERROR_BLOCK_NOT_FOUND | back to summary |
|---|---|
| public static final int ERROR_BLOCK_NOT_FOUND The block in the stream store was not found. | |
| ERROR_CHUNK_NOT_FOUND | back to summary |
|---|---|
| public static final int ERROR_CHUNK_NOT_FOUND The application was trying to read data from a chunk that is no longer available. | |
| ERROR_CLOSED | back to summary |
|---|---|
| public static final int ERROR_CLOSED The object is already closed. | |
| ERROR_FILE_CORRUPT | back to summary |
|---|---|
| public static final int ERROR_FILE_CORRUPT The file is corrupt or (for encrypted files) the encryption key is wrong. | |
| ERROR_FILE_LOCKED | back to summary |
|---|---|
| public static final int ERROR_FILE_LOCKED The file is locked. | |
| ERROR_INTERNAL | back to summary |
|---|---|
| public static final int ERROR_INTERNAL An internal error occurred. This could be a bug, or a memory corruption (for example caused by out of memory). | |
| ERROR_READING_FAILED | back to summary |
|---|---|
| public static final int ERROR_READING_FAILED An error occurred while reading from the file. | |
| ERROR_SERIALIZATION | back to summary |
|---|---|
| public static final int ERROR_SERIALIZATION An error occurred when serializing or de-serializing. | |
| ERROR_TOO_MANY_OPEN_TRANSACTIONS | back to summary |
|---|---|
| public static final int ERROR_TOO_MANY_OPEN_TRANSACTIONS There are too many open transactions. | |
| ERROR_TRANSACTION_CORRUPT | back to summary |
|---|---|
| public static final int ERROR_TRANSACTION_CORRUPT The transaction store is corrupt. | |
| ERROR_TRANSACTION_ILLEGAL_STATE | back to summary |
|---|---|
| public static final int ERROR_TRANSACTION_ILLEGAL_STATE The transaction store is in an illegal state (for example, not yet initialized). | |
| ERROR_TRANSACTION_LOCKED | back to summary |
|---|---|
| public static final int ERROR_TRANSACTION_LOCKED An entry is still locked by another transaction. | |
| ERROR_TRANSACTION_TOO_BIG | back to summary |
|---|---|
| public static final int ERROR_TRANSACTION_TOO_BIG The transaction contains too many changes. | |
| ERROR_TRANSACTIONS_DEADLOCK | back to summary |
|---|---|
| public static final int ERROR_TRANSACTIONS_DEADLOCK Deadlock discovered and one of transactions involved chosen as victim and rolled back. | |
| ERROR_UNKNOWN_DATA_TYPE | back to summary |
|---|---|
| public static final int ERROR_UNKNOWN_DATA_TYPE The transaction store can not be initialized because data type is not found in type registry. | |
| ERROR_UNSUPPORTED_FORMAT | back to summary |
|---|---|
| public static final int ERROR_UNSUPPORTED_FORMAT The file format is not supported. | |
| ERROR_WRITING_FAILED | back to summary |
|---|---|
| public static final int ERROR_WRITING_FAILED An error occurred when trying to write to the file. | |
| META_CHUNK | back to summary |
|---|---|
| public static final String META_CHUNK The prefix for chunks ("chunk."). This, plus the chunk id (hex encoded) is the key, and the serialized chunk metadata is the value. | |
| META_MAP | back to summary |
|---|---|
| public static final String META_MAP The prefix for maps ("map."). This, plus the map id (hex encoded) is the key, and the serialized in the map metadata is the value. | |
| META_NAME | back to summary |
|---|---|
| public static final String META_NAME The prefix for names ("name."). This, plus the name of the map, is the key, and the map id (hex encoded) is the value. | |
| META_ROOT | back to summary |
|---|---|
| public static final String META_ROOT The prefix for root positions of maps ("root."). This, plus the map id (hex encoded) is the key, and the position (hex encoded) is the value. | |
| PAGE_COMPRESSED | back to summary |
|---|---|
| public static final int PAGE_COMPRESSED The bit mask for compressed pages (compression level fast). | |
| PAGE_COMPRESSED_HIGH | back to summary |
|---|---|
| public static final int PAGE_COMPRESSED_HIGH The bit mask for compressed pages (compression level high). | |
| PAGE_LARGE | back to summary |
|---|---|
| public static final int PAGE_LARGE The marker size of a very large page. | |
| PAGE_TYPE_LEAF | back to summary |
|---|---|
| public static final int PAGE_TYPE_LEAF The type for leaf page. | |
| PAGE_TYPE_NODE | back to summary |
|---|---|
| public static final int PAGE_TYPE_NODE The type for node page. | |
| DataUtils | back to summary |
|---|---|
| public DataUtils() | |
| appendMap | back to summary |
|---|---|
| public static StringBuilder appendMap(StringBuilder buff, HashMap<String, ?> map) Append a map to the string builder, sorted by key.
| |
| appendMap | back to summary |
|---|---|
| public 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.
| |
| appendMap | back to summary |
|---|---|
| public static void appendMap(StringBuilder buff, String key, long value) Append a key-value pair to the string builder. Keys may not contain a colon.
| |
| appendMap | back to summary |
|---|---|
| public static void appendMap(StringBuilder buff, String key, int value) Append a key-value pair to the string builder. Keys may not contain a colon.
| |
| appendMapKey | back to summary |
|---|---|
| private static StringBuilder appendMapKey(StringBuilder buff, String key) | |
| checkArgument | back to summary |
|---|---|
| public static void checkArgument(boolean test, String message, Object... arguments) Throw an IllegalArgumentException if the argument is invalid.
| |
| composePagePos | back to summary |
|---|---|
| public static long composePagePos(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 page sequential number, the maximum length, and the type (node or leaf).
| |
| composePagePos | back to summary |
|---|---|
| public static long composePagePos(int chunkId, long tocElement) Convert tocElement into pagePos by replacing mapId with chunkId.
| |
| composeTocElement | back to summary |
|---|---|
| public static long composeTocElement(int mapId, int offset, int length, int type) Create table of content element. The following information is encoded in it: the map id, the page offset, the maximum length, and the type (node or leaf).
| |
| convertToIOException | back to summary |
|---|---|
| public static IOException convertToIOException(Throwable e) Convert an exception to an IO exception.
| |
| copyExcept | back to summary |
|---|---|
| public static void copyExcept(Object src, Object dst, int oldSize, int removeIndex) Copy the elements of an array, and remove one element. | |
| copyWithGap | back to summary |
|---|---|
| public static void copyWithGap(Object src, Object dst, int oldSize, int gapIndex) Copy the elements of an array, with a gap. | |
| decodePageLength | back to summary |
|---|---|
| public static int decodePageLength(int code) Get the maximum length for the given code. For the code 31, PAGE_LARGE is returned.
| |
| encodeLength | back to summary |
|---|---|
| public static int encodeLength(int len) Convert the length to a length code 0..31. 31 means more than 1 MB.
| |
| formatMessage | back to summary |
|---|---|
| public static String formatMessage(int errorCode, String message, Object... arguments) Format an error message. | |
| getCheckValue | back to summary |
|---|---|
| public 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.
| |
| getConfigParam | back to summary |
|---|---|
| pack-priv static int getConfigParam(Map<String, ?> config, String key, int defaultValue) Get the configuration parameter value, or default. | |
| getFletcher32 | back to summary |
|---|---|
| public static int getFletcher32(byte[] bytes, int offset, int length) Calculate the Fletcher32 checksum.
| |
| getFromMap | back to summary |
|---|---|
| public static String getFromMap(String s, String key) Parse a specified pair from key-value pair list.
| |
| getMapName | back to summary |
|---|---|
| public static String getMapName(String s) Parse a name from key-value pair list.
| |
| getPageChunkId | back to summary |
|---|---|
| public static int getPageChunkId(long pos) Get the chunk id from the position.
| |
| getPageMapId | back to summary |
|---|---|
| public static int getPageMapId(long tocElement) Get the map id from the chunk's table of content element.
| |
| getPageMaxLength | back to summary |
|---|---|
| public static int getPageMaxLength(long pos) Get the maximum length for the given page position.
| |
| getPageOffset | back to summary |
|---|---|
| public static int getPageOffset(long tocElement) Get the offset from the position.
| |
| getPageType | back to summary |
|---|---|
| public static int getPageType(long pos) Get the page type from the position.
| |
| getVarIntLen | back to summary |
|---|---|
| public static int getVarIntLen(int x) Get the length of the variable size int.
| |
| getVarLongLen | back to summary |
|---|---|
| public static int getVarLongLen(long x) Get the length of the variable size long.
| |
| initCause | back to summary |
|---|---|
| private static <T extends Exception> T initCause(T e, Object... arguments) | |
| isLeafPosition | back to summary |
|---|---|
| public static boolean isLeafPosition(long pos) Determines whether specified file position corresponds to a leaf page
| |
| isPageRemoved | back to summary |
|---|---|
| pack-priv static boolean isPageRemoved(long pos) Find out if page was removed.
| |
| isPageSaved | back to summary |
|---|---|
| public static boolean isPageSaved(long pos) Find out if page was saved.
| |
| newIllegalArgumentException | back to summary |
|---|---|
| public static IllegalArgumentException newIllegalArgumentException(String message, Object... arguments) Create a new IllegalArgumentException.
| |
| newMVStoreException | back to summary |
|---|---|
| public static MVStoreException newMVStoreException(int errorCode, String message, Object... arguments) Create a new MVStoreException.
| |
| newUnsupportedOperationException | back to summary |
|---|---|
| public static UnsupportedOperationException newUnsupportedOperationException(String message) Create a new UnsupportedOperationException.
| |
| parseChecksummedMap | back to summary |
|---|---|
| pack-priv static HashMap Parse a key-value pair list and checks its checksum. | |
| parseHexBytes | back to summary |
|---|---|
| pack-priv static byte[] parseHexBytes(Map<String, ?> map, String key) Parse the hex-encoded bytes of an entry in the map. | |
| parseHexInt | back to summary |
|---|---|
| public static int parseHexInt(String x) Parse an unsigned, hex long.
| |
| parseHexLong | back to summary |
|---|---|
| public static long parseHexLong(String x) Parse an unsigned, hex long.
| |
| parseMap | back to summary |
|---|---|
| public static HashMap Parse a key-value pair list.
| |
| parseMapValue | back to summary |
|---|---|
private static int parseMapValue(StringBuilder buff, String s, int i, int size)
| |
| readFully | back to summary |
|---|---|
| public 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.
| |
| readHexInt | back to summary |
|---|---|
| pack-priv static int readHexInt(Map<String, ?> map, String key, int defaultValue) Read a hex int value from a map.
| |
| readHexLong | back to summary |
|---|---|
| public static long readHexLong(Map<String, ?> map, String key, long defaultValue) Read a hex long value from a map.
| |
| readString | back to summary |
|---|---|
| public static String readString(ByteBuffer buff) Read a string.
| |
| readString | back to summary |
|---|---|
| public static String readString(ByteBuffer buff, int len) Read a string.
| |
| readVarInt | back to summary |
|---|---|
| public static int readVarInt(ByteBuffer buff) Read a variable size int.
| |
| readVarIntRest | back to summary |
|---|---|
| private static int readVarIntRest(ByteBuffer buff, int b) | |
| readVarLong | back to summary |
|---|---|
| public static long readVarLong(ByteBuffer buff) Read a variable size long.
| |
| writeFully | back to summary |
|---|---|
| public static void writeFully(FileChannel file, long pos, ByteBuffer src) Write to a file channel.
| |
| writeStringData | back to summary |
|---|---|
| public static void writeStringData(ByteBuffer buff, String s, int len) Write characters from a string (without the length).
| |
| writeVarInt | back to summary |
|---|---|
| public static void writeVarInt(OutputStream out, int x) throws IOException Write a variable size int.
| |
| writeVarInt | back to summary |
|---|---|
| public static void writeVarInt(ByteBuffer buff, int x) Write a variable size int.
| |
| writeVarLong | back to summary |
|---|---|
| public static void writeVarLong(ByteBuffer buff, long x) Write a variable size long.
| |
| writeVarLong | back to summary |
|---|---|
| public static void writeVarLong(OutputStream out, long x) throws IOException Write a variable size long.
| |