| java.lang.Object com.sleepycat.util.UtfOps
UtfOps | public class UtfOps (Code) | | UTF operations with more flexibility than is provided by DataInput and
DataOutput.
author: Mark Hayes |
Method Summary | |
public static int | bytesToChars(byte[] bytes, int byteOffset, char[] chars, int charOffset, int len, boolean isByteLen) Converts byte arrays into character arrays. | public static String | bytesToString(byte[] bytes, int offset, int length) Converts byte arrays into strings.
Parameters: bytes - the source byte data to convert Parameters: offset - the offset into the byte array at whichto start the conversion Parameters: length - the number of bytes to be converted. | public static void | charsToBytes(char[] chars, int charOffset, byte[] bytes, int byteOffset, int charLength) Converts character arrays into byte arrays. | public static int | getByteLength(char[] chars) Returns the byte length of the UTF string that would be created by
converting the given characters to UTF.
Parameters: chars - the characters that would be converted. | public static int | getByteLength(char[] chars, int offset, int length) Returns the byte length of the UTF string that would be created by
converting the given characters to UTF.
Parameters: chars - the characters that would be converted. Parameters: offset - the first character to be converted. Parameters: length - the number of characters to be converted. | public static int | getCharLength(byte[] bytes) Returns the number of characters represented by the given UTF string.
Parameters: bytes - the UTF string. | public static int | getCharLength(byte[] bytes, int offset, int length) Returns the number of characters represented by the given UTF string. | public static int | getZeroTerminatedByteLength(byte[] bytes, int offset) Returns the byte length of a null terminated UTF string, not including
the terminator.
Parameters: bytes - the data containing the UTF string. Parameters: offset - the beginning of the string the measure. throws: IndexOutOfBoundsException - if no zero terminator is found. | public static byte[] | stringToBytes(String string) Converts strings to byte arrays.
Parameters: string - the string to convert. |
bytesToChars | public static int bytesToChars(byte[] bytes, int byteOffset, char[] chars, int charOffset, int len, boolean isByteLen) throws IllegalArgumentException, IndexOutOfBoundsException(Code) | | Converts byte arrays into character arrays.
Parameters: bytes - the source byte data to convert Parameters: byteOffset - the offset into the byte array at whichto start the conversion Parameters: chars - the destination array Parameters: charOffset - the offset into chars at which to begin the copy Parameters: len - the amount of information to copy into chars Parameters: isByteLen - if true then len is a measure of bytes, otherwiselen is a measure of characters throws: IndexOutOfBoundsException - if a UTF character sequence at the endof the data is not complete. throws: IllegalArgumentException - if an illegal UTF sequence isencountered. |
bytesToString | public static String bytesToString(byte[] bytes, int offset, int length) throws IllegalArgumentException, IndexOutOfBoundsException(Code) | | Converts byte arrays into strings.
Parameters: bytes - the source byte data to convert Parameters: offset - the offset into the byte array at whichto start the conversion Parameters: length - the number of bytes to be converted. the string. throws: IndexOutOfBoundsException - if a UTF character sequence at the endof the data is not complete. throws: IllegalArgumentException - if an illegal UTF sequence isencountered. |
charsToBytes | public static void charsToBytes(char[] chars, int charOffset, byte[] bytes, int byteOffset, int charLength)(Code) | | Converts character arrays into byte arrays.
Parameters: chars - the source character data to convert Parameters: charOffset - the offset into the character array at whichto start the conversion Parameters: bytes - the destination array Parameters: byteOffset - the offset into bytes at which to begin the copy Parameters: charLength - the length of characters to copy into bytes |
getByteLength | public static int getByteLength(char[] chars)(Code) | | Returns the byte length of the UTF string that would be created by
converting the given characters to UTF.
Parameters: chars - the characters that would be converted. the byte length of the equivalent UTF data. |
getByteLength | public static int getByteLength(char[] chars, int offset, int length)(Code) | | Returns the byte length of the UTF string that would be created by
converting the given characters to UTF.
Parameters: chars - the characters that would be converted. Parameters: offset - the first character to be converted. Parameters: length - the number of characters to be converted. the byte length of the equivalent UTF data. |
getCharLength | public static int getCharLength(byte[] bytes, int offset, int length) throws IllegalArgumentException, IndexOutOfBoundsException(Code) | | Returns the number of characters represented by the given UTF string.
Parameters: bytes - the data containing the UTF string. Parameters: offset - the first byte to be converted. Parameters: length - the number of byte to be converted. throws: IndexOutOfBoundsException - if a UTF character sequence at the endof the data is not complete. throws: IllegalArgumentException - if an illegal UTF sequence isencountered. |
getZeroTerminatedByteLength | public static int getZeroTerminatedByteLength(byte[] bytes, int offset) throws IndexOutOfBoundsException(Code) | | Returns the byte length of a null terminated UTF string, not including
the terminator.
Parameters: bytes - the data containing the UTF string. Parameters: offset - the beginning of the string the measure. throws: IndexOutOfBoundsException - if no zero terminator is found. the number of bytes. |
stringToBytes | public static byte[] stringToBytes(String string)(Code) | | Converts strings to byte arrays.
Parameters: string - the string to convert. the UTF byte array. |
|
|