| java.lang.Object com.healthmarketscience.jackcess.ByteUtil
ByteUtil | final public class ByteUtil (Code) | | Byte manipulation and display utilities
author: Tim McCune |
Method Summary | |
public static int | asUnsignedByte(byte b) | public static void | clearRange(ByteBuffer buffer, int start, int end) Sets all bits in the given byte range to 0. | public static void | fillRange(ByteBuffer buffer, int start, int end) Sets all bits in the given byte range to 1. | public static int | get3ByteInt(ByteBuffer buffer) | public static int | get3ByteInt(ByteBuffer buffer, ByteOrder order) | public static int | get3ByteInt(ByteBuffer buffer, int offset) | public static int | get3ByteInt(ByteBuffer buffer, int offset, ByteOrder order) | public static int | getInt(ByteBuffer buffer, ByteOrder order) | public static int | getInt(ByteBuffer buffer, int offset, ByteOrder order) | public static int | getUnsignedByte(ByteBuffer buffer) | public static int | getUnsignedByte(ByteBuffer buffer, int offset) | public static boolean | matchesRange(ByteBuffer buffer, int start, byte[] pattern) Matches a pattern of bytes against the given buffer starting at the given
offset. | public static void | put3ByteInt(ByteBuffer buffer, int val) Put an integer into the given buffer at the given offset as a 3-byte
integer. | public static void | put3ByteInt(ByteBuffer buffer, int val, ByteOrder order) Put an integer into the given buffer at the given offset as a 3-byte
integer. | public static void | put3ByteInt(ByteBuffer buffer, int val, int offset, ByteOrder order) Put an integer into the given buffer at the given offset as a 3-byte
integer. | public static void | putInt(ByteBuffer buffer, int val, ByteOrder order) | public static void | putInt(ByteBuffer buffer, int val, int offset, ByteOrder order) | public static void | putRange(ByteBuffer buffer, int start, int end, byte b) Sets all bytes in the given byte range to the given byte value. | public static void | toHexFile(String fileName, ByteBuffer buffer, int offset, int size) Writes a chunk of data to a file in pretty printed hexidecimal. | public static String | toHexString(ByteBuffer buffer, int size) | public static String | toHexString(byte[] array) | public static String | toHexString(ByteBuffer buffer, int offset, int size) | public static String | toHexString(ByteBuffer buffer, int offset, int size, boolean formatted) | public static void | writeHexString(ByteBuffer buffer, String hexStr) Writes a sequence of hexidecimal values into the given buffer, where
every two characters represent one byte value. |
asUnsignedByte | public static int asUnsignedByte(byte b)(Code) | | the byte value converted to an unsigned int value |
clearRange | public static void clearRange(ByteBuffer buffer, int start, int end)(Code) | | Sets all bits in the given byte range to 0.
|
fillRange | public static void fillRange(ByteBuffer buffer, int start, int end)(Code) | | Sets all bits in the given byte range to 1.
|
get3ByteInt | public static int get3ByteInt(ByteBuffer buffer)(Code) | | Read a 3 byte int from a buffer
Parameters: buffer - Buffer containing the bytes The int |
get3ByteInt | public static int get3ByteInt(ByteBuffer buffer, ByteOrder order)(Code) | | Read a 3 byte int from a buffer
Parameters: buffer - Buffer containing the bytes Parameters: order - the order of the bytes of the int The int |
get3ByteInt | public static int get3ByteInt(ByteBuffer buffer, int offset)(Code) | | Read a 3 byte int from a buffer
Parameters: buffer - Buffer containing the bytes Parameters: offset - Offset at which to start reading the int The int |
get3ByteInt | public static int get3ByteInt(ByteBuffer buffer, int offset, ByteOrder order)(Code) | | Read a 3 byte int from a buffer
Parameters: buffer - Buffer containing the bytes Parameters: offset - Offset at which to start reading the int Parameters: order - the order of the bytes of the int The int |
getInt | public static int getInt(ByteBuffer buffer, ByteOrder order)(Code) | | Parameters: buffer - Buffer containing the bytes Parameters: order - the order of the bytes of the int an int from the current position in the given buffer, read usingthe given ByteOrder |
getInt | public static int getInt(ByteBuffer buffer, int offset, ByteOrder order)(Code) | | Parameters: buffer - Buffer containing the bytes Parameters: offset - Offset at which to start reading the int Parameters: order - the order of the bytes of the int an int from the given position in the given buffer, read usingthe given ByteOrder |
getUnsignedByte | public static int getUnsignedByte(ByteBuffer buffer)(Code) | | Read a 3 byte int from a buffer
Parameters: buffer - Buffer containing the bytes The int |
getUnsignedByte | public static int getUnsignedByte(ByteBuffer buffer, int offset)(Code) | | Read a 3 byte int from a buffer
Parameters: buffer - Buffer containing the bytes Parameters: offset - Offset at which to read the byte The int |
matchesRange | public static boolean matchesRange(ByteBuffer buffer, int start, byte[] pattern)(Code) | | Matches a pattern of bytes against the given buffer starting at the given
offset.
|
put3ByteInt | public static void put3ByteInt(ByteBuffer buffer, int val)(Code) | | Put an integer into the given buffer at the given offset as a 3-byte
integer.
Parameters: buffer - buffer into which to insert the int Parameters: val - Int to convert |
put3ByteInt | public static void put3ByteInt(ByteBuffer buffer, int val, ByteOrder order)(Code) | | Put an integer into the given buffer at the given offset as a 3-byte
integer.
Parameters: buffer - buffer into which to insert the int Parameters: val - Int to convert Parameters: order - the order to insert the bytes of the int |
put3ByteInt | public static void put3ByteInt(ByteBuffer buffer, int val, int offset, ByteOrder order)(Code) | | Put an integer into the given buffer at the given offset as a 3-byte
integer.
Parameters: buffer - buffer into which to insert the int Parameters: val - Int to convert Parameters: offset - offset at which to insert the int Parameters: order - the order to insert the bytes of the int |
putInt | public static void putInt(ByteBuffer buffer, int val, ByteOrder order)(Code) | | Writes an int at the current position in the given buffer, using the
given ByteOrder
Parameters: buffer - buffer into which to insert the int Parameters: val - Int to insert Parameters: order - the order to insert the bytes of the int |
putInt | public static void putInt(ByteBuffer buffer, int val, int offset, ByteOrder order)(Code) | | Writes an int at the given position in the given buffer, using the
given ByteOrder
Parameters: buffer - buffer into which to insert the int Parameters: val - Int to insert Parameters: offset - offset at which to insert the int Parameters: order - the order to insert the bytes of the int |
putRange | public static void putRange(ByteBuffer buffer, int start, int end, byte b)(Code) | | Sets all bytes in the given byte range to the given byte value.
|
toHexFile | public static void toHexFile(String fileName, ByteBuffer buffer, int offset, int size) throws IOException(Code) | | Writes a chunk of data to a file in pretty printed hexidecimal.
|
toHexString | public static String toHexString(ByteBuffer buffer, int size)(Code) | | Convert a byte buffer to a hexadecimal string for display
Parameters: buffer - Buffer to display, starting at offset 0 Parameters: size - Number of bytes to read from the buffer The display String |
toHexString | public static String toHexString(byte[] array)(Code) | | Convert a byte array to a hexadecimal string for display
Parameters: buffer - Buffer to display, starting at offset 0 The display String |
toHexString | public static String toHexString(ByteBuffer buffer, int offset, int size)(Code) | | Convert a byte buffer to a hexadecimal string for display
Parameters: buffer - Buffer to display, starting at offset 0 Parameters: offset - Offset at which to start reading the buffer Parameters: size - Number of bytes to read from the buffer The display String |
toHexString | public static String toHexString(ByteBuffer buffer, int offset, int size, boolean formatted)(Code) | | Convert a byte buffer to a hexadecimal string for display
Parameters: buffer - Buffer to display, starting at offset 0 Parameters: offset - Offset at which to start reading the buffer Parameters: size - Number of bytes to read from the buffer Parameters: formatted - flag indicating if formatting is required The display String |
writeHexString | public static void writeHexString(ByteBuffer buffer, String hexStr) throws IOException(Code) | | Writes a sequence of hexidecimal values into the given buffer, where
every two characters represent one byte value.
|
|
|