All Packages  This Package  Class Hierarchy  Class Search  Index

Class com.syncbuilder.util.PackUtils
java.lang.Object
   |
   +----com.syncbuilder.util.PackUtils

  Summary

public final class  PackUtils
     extends java.lang.Object
{
          // Methods 6
     public static int getLong(byte[], int) throws ArrayIndexOutOfBoundsException;
     public static int getShort(byte[], int) throws ArrayIndexOutOfBoundsException;
     public static String getZeroTermString(byte[], int, Index) throws ArrayIndexOutOfBoundsException;
     public static void setLong(byte[], int, int) throws ArrayIndexOutOfBoundsException;
     public static void setShort(byte[], int, int) throws ArrayIndexOutOfBoundsException;
     public static int setZeroTermString(byte[], int, String) throws ArrayIndexOutOfBoundsException;

}

A collection of static helper-methods for packing/unpacking of the native Records, AppInfos, SortInfos, etc.




  Methods

· getZeroTermString

Summary  |  Top

   public static String getZeroTermString(byte[] data, 
                                          int offset, 
                                          Index newoff)  throws 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.

Parameter Description
data the array of bytes from which the String is extracted
offset the beginning of the string within the array
newoff 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

Summary  |  Top
   public static int setZeroTermString(byte[] data, 
                                       int offset, 
                                       String text)  throws 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.

Parameter Description
data the array where the result will be placed
offset the place in the array where the result will be placed
the String. null is equivalent to an empty string

Returns:
the offset in the array right behind the terminating 0x00-byte


· setShort

Summary  |  Top
   public static void setShort(byte[] data, 
                               int offset, 
                               int s)  throws ArrayIndexOutOfBoundsException


· getShort

Summary  |  Top
   public static int getShort(byte[] data, 
                              int offset)  throws ArrayIndexOutOfBoundsException


· getLong

Summary  |  Top
   public static int getLong(byte[] data, 
                             int offset)  throws ArrayIndexOutOfBoundsException


· setLong

Summary  |  Top
   public static void setLong(byte[] data, 
                              int offset, 
                              int s)  throws ArrayIndexOutOfBoundsException


All Packages  This Package  Class Hierarchy  Class Search  Index
Freshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7