| 
Berkeley DB version 5.3.28  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sleepycat.util.UtfOps
public class UtfOps
UTF operations with more flexibility than is provided by DataInput and DataOutput.
| Constructor Summary | |
|---|---|
UtfOps()
 | 
|
| Method Summary | |
|---|---|
static int | 
bytesToChars(byte[] bytes,
             int byteOffset,
             char[] chars,
             int charOffset,
             int len,
             boolean isByteLen)
Converts byte arrays into character arrays.  | 
static String | 
bytesToString(byte[] bytes,
              int offset,
              int length)
Converts byte arrays into strings.  | 
static void | 
charsToBytes(char[] chars,
             int charOffset,
             byte[] bytes,
             int byteOffset,
             int charLength)
Converts character arrays into byte arrays.  | 
static int | 
getByteLength(char[] chars)
Returns the byte length of the UTF string that would be created by converting the given characters to UTF.  | 
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.  | 
static int | 
getCharLength(byte[] bytes)
Returns the number of characters represented by the given UTF string.  | 
static int | 
getCharLength(byte[] bytes,
              int offset,
              int length)
Returns the number of characters represented by the given UTF string.  | 
static int | 
getZeroTerminatedByteLength(byte[] bytes,
                            int offset)
Returns the byte length of a null terminated UTF string, not including the terminator.  | 
static byte[] | 
stringToBytes(String string)
Converts strings to byte arrays.  | 
| Methods inherited from class java.lang.Object | 
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait | 
| Constructor Detail | 
|---|
public UtfOps()
| Method Detail | 
|---|
public static int getZeroTerminatedByteLength(byte[] bytes,
                                              int offset)
                                       throws IndexOutOfBoundsException
bytes - the data containing the UTF string.offset - the beginning of the string the measure.
IndexOutOfBoundsException - if no zero terminator is found.public static int getByteLength(char[] chars)
chars - the characters that would be converted.
public static int getByteLength(char[] chars,
                                int offset,
                                int length)
chars - the characters that would be converted.offset - the first character to be converted.length - the number of characters to be converted.
public static int getCharLength(byte[] bytes)
                         throws IllegalArgumentException,
                                IndexOutOfBoundsException
bytes - the UTF string.
IndexOutOfBoundsException - if a UTF character sequence at the end
 of the data is not complete.
IllegalArgumentException - if an illegal UTF sequence is
 encountered.
public static int getCharLength(byte[] bytes,
                                int offset,
                                int length)
                         throws IllegalArgumentException,
                                IndexOutOfBoundsException
bytes - the data containing the UTF string.offset - the first byte to be converted.length - the number of byte to be converted.
IndexOutOfBoundsException - if a UTF character sequence at the end
 of the data is not complete.
IllegalArgumentException - if an illegal UTF sequence is
 encountered.
public static int bytesToChars(byte[] bytes,
                               int byteOffset,
                               char[] chars,
                               int charOffset,
                               int len,
                               boolean isByteLen)
                        throws IllegalArgumentException,
                               IndexOutOfBoundsException
bytes - the source byte data to convertbyteOffset - the offset into the byte array at which
 to start the conversionchars - the destination arraycharOffset - the offset into chars at which to begin the copylen - the amount of information to copy into charsisByteLen - if true then len is a measure of bytes, otherwise
 len is a measure of characters
IndexOutOfBoundsException - if a UTF character sequence at the end
 of the data is not complete.
IllegalArgumentException - if an illegal UTF sequence is
 encountered.
public static void charsToBytes(char[] chars,
                                int charOffset,
                                byte[] bytes,
                                int byteOffset,
                                int charLength)
chars - the source character data to convertcharOffset - the offset into the character array at which
 to start the conversionbytes - the destination arraybyteOffset - the offset into bytes at which to begin the copycharLength - the length of characters to copy into bytes
public static String bytesToString(byte[] bytes,
                                   int offset,
                                   int length)
                            throws IllegalArgumentException,
                                   IndexOutOfBoundsException
bytes - the source byte data to convertoffset - the offset into the byte array at which
 to start the conversionlength - the number of bytes to be converted.
IndexOutOfBoundsException - if a UTF character sequence at the end
 of the data is not complete.
IllegalArgumentException - if an illegal UTF sequence is
 encountered.public static byte[] stringToBytes(String string)
string - the string to convert.
  | 
Berkeley DB version 5.3.28  | 
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||