com.syncbuilder.util
Class PackUtils
java.lang.Object
|
+--com.syncbuilder.util.PackUtils
- public final class PackUtils
- extends java.lang.Object
A collection of static helper-methods for packing/unpacking of the
native Records, AppInfos, SortInfos, etc.
|
Method Summary |
static int |
getLong(byte[] data,
int offset)
|
static int |
getShort(byte[] data,
int offset)
|
static java.lang.String |
getZeroTermString(byte[] data,
int offset,
Index newoff)
Extract a String from the data-array. |
static void |
setLong(byte[] data,
int offset,
int s)
|
static void |
setShort(byte[] data,
int offset,
int s)
|
static int |
setZeroTermString(byte[] data,
int offset,
java.lang.String text)
Place a String into an array of bytes. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
getZeroTermString
public static java.lang.String getZeroTermString(byte[] data,
int offset,
Index newoff)
throws java.lang.ArrayIndexOutOfBoundsException
- Extract a String from the data-array. The beginning of the
String within the array is specified by the offset. The end
of the string is automatically determined by looking for a
0x00-byte.
- Parameters:
data - the array of bytes from which the String is extractedoffset - the beginning of the string within the arraynewoff - an Index, which will be set to the offset right behind
the terminating 0x00-byte, or null if you are not interested
in this information- Returns:
- a Java.lang.String, with NO terminating 0x00-byte
setZeroTermString
public static int setZeroTermString(byte[] data,
int offset,
java.lang.String text)
throws java.lang.ArrayIndexOutOfBoundsException
- Place a String into an array of bytes. The string-data in the
array will be zero-terminated. The array therefore needs to be
1 byte longer than the string.
- Parameters:
data - the array where the result will be placedoffset - the place in the array where the result will be placedthe - String. null is equivalent to an empty string- Returns:
- the offset in the array right behind the terminating 0x00-byte
setShort
public static void setShort(byte[] data,
int offset,
int s)
throws java.lang.ArrayIndexOutOfBoundsException
getShort
public static int getShort(byte[] data,
int offset)
throws java.lang.ArrayIndexOutOfBoundsException
getLong
public static int getLong(byte[] data,
int offset)
throws java.lang.ArrayIndexOutOfBoundsException
setLong
public static void setLong(byte[] data,
int offset,
int s)
throws java.lang.ArrayIndexOutOfBoundsException
This material is Copyrighted (C) 1999 by Tilo Christ. All Rights Reserved.