public class JPack
extends java.lang.Object
implements java.io.Externalizable
JPack
object provides a flexible way of storing structured data. It is a binary format that allows storing either atomic data of different types
or lists and records of data. A record pack consists of items (which can be of different types) which are accessed by key. The key is a 32 bits integer
usually built up from a 4 byte string. The conversion is done through a call to buildKey(String)
. A list pack consists of items (which can be
of different types) which are accessed by index (starting at 0), like in a normal collection. //Create a list of users with the structure: { String:name, { int:nb, String:street}} int KEY_USER = JPack.buildKey("User"); int KEY_ADDRESS = JPack.buildKey("Addr"); int KEY_STREET = JPack.buildKey("User"); int KEY_NUMBER = JPack.buildKey("Numb"); JPack users = JPack.newListPack(); JPack user = JPack.newRecordPack(); JPack home = JPack.newRecordPack(); user.putString( KEY_USER, "John Doe"); home.putInt( KEY_NUMBER, 21); home.putString( KEY_STREET, "Nowhere Str."); user.putPackage(KEY_ADDRESS, home); users.putPackageAt(user); ... //Displays all users in the list for(int i = 0; i < users.countItems(); i++) { try { user = users.getPackageAt(i); home = user.getPackage(KEY_ADDRESS); System.out.println(user.getString(KEY_USER) + ": " + home.getInt(KEY_NUMBER) + " " + home.getString(KEY_STREET)); } catch(JPack.NoSuchElementException e) { } }
Modifier and Type | Class and Description |
---|---|
static class |
JPack.InitializationEvent
The event object for the
JPack.InitializationListener . |
static interface |
JPack.InitializationListener
Listener for the initialization of a JPack instance.
|
static class |
JPack.JSONParser |
class |
JPack.NoSuchElementException |
Modifier and Type | Field and Description |
---|---|
static int |
INTEL_BYTE_ORDER
Intel byte order (a.k.a. LSB first).
|
static int |
NATIVE_BYTE_ORDER
Native byte order of the running computer.
|
static int |
NETWORK_BYTE_ORDER
Network byte order (a.k.a. Motorola, MSB first).
|
static int |
PACK_TYPE_ALIAS
Pack type for a Mac OS Alias.
|
static int |
PACK_TYPE_BOOL
Pack type for a boolean.
|
static int |
PACK_TYPE_BYTE
Pack type for a byte or an array of bytes.
|
static int |
PACK_TYPE_DOUBLE
Pack type for a double (64 bits floating point).
|
static int |
PACK_TYPE_GUID
Pack type for a
GUID . |
static int |
PACK_TYPE_INT
Pack type for a 32 bits integer or an array of 32 bits integers.
|
static int |
PACK_TYPE_LIST
Pack type for a list pack.
|
static int |
PACK_TYPE_LOCAL_CHARS
Pack type for strings in local encoding.
|
static int |
PACK_TYPE_LONG
Pack type for a 64 bits integer or an array of 64 bits integers.
|
static int |
PACK_TYPE_RECORD
Pack type for a record pack.
|
static int |
PACK_TYPE_SHORT
Pack type for a 16 bits integer or an array of 16 bits integers.
|
static int |
PACK_TYPE_STRING
Pack type for a
String . |
Constructor and Description |
---|
JPack() |
JPack(byte[] initCore)
Creates a new
JPack from a byte array. |
JPack(java.lang.String xml) |
Modifier and Type | Method and Description |
---|---|
void |
addInitializationListener(JPack.InitializationListener listener) |
static int |
buildKey(java.lang.String s)
Converts a string to a record pack key (which is a 32-bits integer).
|
int |
countItems()
Returns the number of items in the pack.
|
void |
deleteItem(int key)
Deletes the item with the given key from the pack (Record packs only).
|
void |
deleteItemAt(int ulIndex)
Deletes the item at the given index (List packs only).
|
boolean |
equals(JPack pack)
Compares this pack to the specified pack.
|
static JPack |
fromJSON(java.lang.String json)
Create JPack instance from JSON formatted String.
|
boolean |
getBoolean(int key)
Return the item value with the given key as a boolean (Record packs only).
|
boolean[] |
getBooleanArray(int key)
Returns the item values with the given key as a boolean (Record packs only).
|
boolean[] |
getBooleanArrayAt(int index)
Returns the item value at the given index as an array of booleans (List packs only).
|
boolean |
getBooleanAt(int ulIndex)
Returns the item value at the given index as a boolean (List packs only).
|
byte |
getByte(int key)
Returns the item value with the given key as a byte (Record packs only).
|
byte[] |
getByteArray(int key)
Returns the item values with the given key as a byte (Record packs only).
|
byte[] |
getByteArrayAt(int index)
Returns the item value at the given index as an array of bytes (List packs only).
|
byte |
getByteAt(int ulIndex)
Returns the item value at the given index as a byte (List packs only).
|
byte[] |
getData()
Returns the pack content as a byte array in network byte order.
|
byte[] |
getData(int byteOrder)
Returns the pack content as a byte array in the specified byte order.
|
int |
getDataSize()
Returns the total size of the pack.
|
double |
getDouble(int key)
Return the item value with the given key as a double (Record packs only).
|
double[] |
getDoubleArray(int key)
Returns the item value with the given key as an array of doubles (Record packs only).
|
double[] |
getDoubleArrayAt(int index)
Returns the item value at the given index as an array of 64-bits integers (List packs only).
|
double |
getDoubleAt(int ulIndex)
Returns the item value at the given index as a double (List packs only).
|
GUID |
getGUID(int key)
Returns the item value with the given key as a
GUID object (Record packs only). |
GUID[] |
getGUIDArray(int key)
Returns the item value with the given key as an array of
GUIDs (Record packs only). |
GUID[] |
getGUIDArrayAt(int index)
Returns the item value at the given index as an array of GUIDs (List packs only).
|
GUID |
getGuidAt(int ulIndex)
Returns the item value at the given index as a
GUID object (List packs only). |
int |
getIndKey(int ulIndex)
Returns the key for an item by index (Record packs only).
|
JPack.InitializationListener[] |
getInitializationListeners() |
int |
getInt(int key)
Returns the item value with the given key as a 32-bits integer (Record packs only).
|
int[] |
getIntArray(int key)
Returns the item value with the given key as an array of 32-bits integers (Record packs only).
|
int[] |
getIntArrayAt(int index)
Returns the item value at the given index as an array of 32-bits integers (List packs only).
|
int |
getIntAt(int ulIndex)
Returns the item value at the given index as a 32-bits integer (List packs only).
|
byte[] |
getItemData(int key,
int type)
Returns the data of the item with the given key (Record packs only).
|
byte[] |
getItemDataAt(int ulIndex,
int type)
Returns the value of the item at the given index (List packs only).
|
int |
getItemSize(int key)
Returns the data size of the item with the given key (Record packs only).
|
int |
getItemSizeAt(int ulIndex)
Returns the data size of the item at the given index (List packs only).
|
int |
getItemType(int key)
Returns the data type of the item with the given key (Record packs only).
|
int |
getItemTypeAt(int ulIndex)
Returns the type of the item with the given index (List packs only).
|
java.util.Iterator<JPack> |
getListItemsIterator()
Returns an
Iterator for iterating all contained Packs. |
long |
getLong(int key)
Returns the item value with the given key as a 64-bits integer (Record packs only).
|
long[] |
getLongArray(int key)
Returns the item value with the given key as an array of 64-bits integers (Record packs only).
|
long[] |
getLongArrayAt(int index)
Returns the item value at the given index as an array of 64-bits integers (List packs only).
|
long |
getLongAt(int ulIndex)
Returns the item value at the given index as a 64-bits integer (List packs only).
|
int |
getOriginalByteOrder() |
JPack |
getPackage(int key)
Returns the item value with the given key as a
Pack object (Record packs only). |
JPack |
getPackageAt(int ulIndex)
Returns the item value at the given index as a
Pack<code> object (<b>List packs only</b>). |
short |
getShort(int key)
Returns the item value with the given key as a 16-bits integer (Record packs only).
|
short[] |
getShortArray(int key)
Returns the item values with the given key as a 16-bits integer (Record packs only).
|
short[] |
getShortArrayAt(int index)
Returns the item values with the given index as a 16-bits integer (Record packs only).
|
short |
getShortAt(int ulIndex)
Returns the item value at the given index as a 16-bits integer (List packs only).
|
java.lang.String |
getString(int key)
Returns the item value with the given key as a
String (Record packs only). |
java.lang.String |
getStringAt(int ulIndex)
Returns the item value at the given index as a
String object (List packs only). |
int |
getType()
Returns the pack type.
|
java.lang.String |
getXML()
Returns this pack as XML structure.
|
boolean |
hasItem(int key)
Return whethers the pack contains an item with the given key (Record packs only).
|
void |
initializeFromData(byte[] initCore)
Initializes a pack from a byte array.
|
static java.lang.String |
keyToString(int key)
Converts the given record pack key value to a string representation.
|
static JPack |
newListPack()
Creates a new empty list pack.
|
static JPack |
newRecordPack()
Creates a new empty record pack.
|
void |
prepareCache() |
void |
putBoolean(int key,
boolean value)
Adds a new boolean item to the pack (Record packs only).
|
void |
putBooleanArray(int key,
boolean[] value)
Adds a new array of booleans to the pack (Record packs only).
|
void |
putBooleanAt(boolean value)
Adds a new boolean item to the end of the pack (List packs only).
|
void |
putBooleanAt(boolean value,
int ulIndex)
Inserts a new boolean item into the list at a given location (List packs only).
|
void |
putByte(int key,
byte value)
Adds a new byte item to the pack (Record packs only).
|
void |
putByteArray(int key,
byte[] value)
Adds a new array of bytes to the pack (Record packs only).
|
void |
putByteAt(byte value)
Adds a new byte item at the end of the pack (List packs only).
|
void |
putByteAt(byte value,
int ulIndex)
Inserts a new byte item into the pack at a given index (List packs only).
|
void |
putDouble(int key,
double value)
Adds a new double item to the pack (Record packs only).
|
void |
putDoubleArray(int key,
double[] value)
Adds a new array of doubles to the pack (Record packs only).
|
void |
putDoubleAt(double value)
Adds a new double item at the end of the pack (List packs only).
|
void |
putDoubleAt(double value,
int ulIndex)
Insert a new double item into the pack at a given index (List packs only).
|
void |
putGUID(int key,
GUID value)
Adds a new
GUID item to the pack (Record packs only). |
void |
putGUIDArray(int key,
GUID[] value)
Adds an array of
GUIDs to the pack (Record packs only). |
void |
putGUIDAt(GUID value)
Add a new
GUID item at the end of the pack (List packs only). |
void |
putGUIDAt(GUID value,
int ulIndex)
Inserts a new
GUID item into the pack at a given index (List packs only). |
void |
putInt(int key,
int value)
Adds a new 32-bits integer item to the pack (Record packs only).
|
void |
putIntArray(int key,
int[] value)
Adds a new array of 32-bits integers to the pack (Record packs only).
|
void |
putIntAt(int value)
Adds a new 32-bits integer item at the end of the pack (List packs only).
|
void |
putIntAt(int value,
int ulIndex)
Inserts a new 32-bits integer item into the pack at a given index (List packs only).
|
void |
putItemData(int key,
int type,
byte[] newItem)
Adds a new item to the pack (Record packs only).
|
void |
putItemDataAt(int type,
byte[] ptr)
Adds a new item at the end of the pack (List packs only).
|
void |
putItemDataAt(int type,
byte[] ptr,
int ulIndex)
Inserts a new item into the pack at a given index (List packs only).
|
void |
putLong(int key,
long value)
Adds a new 64-bits integer item to the pack (Record packs only).
|
void |
putLongArray(int key,
long[] value)
Adds a new array of 64-bits integers to the pack (Record packs only).
|
void |
putLongAt(long value)
Add a new 64-bits integer item at the end of the pack (List packs only).
|
void |
putLongAt(long value,
int ulIndex)
Inserts a new 64-bit integer item into the pack at a given index (List packs only).
|
void |
putPackage(int key,
JPack pack)
Adds a new pack item to the pack (Record packs only).
|
void |
putPackageAt(JPack pack)
Adds a new
Pack item at the end of the pack (List packs only). |
void |
putPackageAt(JPack pack,
int ulIndex)
Inserts a new
Pack item into the pack at a given index (List packs only). |
void |
putShort(int key,
short value)
Adds a new 16-bits integer item to the pack (Record packs only).
|
void |
putShortArray(int key,
short[] value)
Adds a new array of 16-bits integers to the pack (Record packs only).
|
void |
putShortAt(short value)
Add a new 16-bits integer item at the end of the pack (List packs only).
|
void |
putShortAt(short value,
int ulIndex)
Inserts a new 16-bits integer item into the pack at a given index (List packs only).
|
void |
putString(int key,
java.lang.String value)
Adds a new
String item to the pack (Record packs only). |
void |
putStringAt(java.lang.String value)
Adds a new
String item at the end of the pack (List packs only). |
void |
putStringAt(java.lang.String value,
int ulIndex)
Inserts a new
String item into the pack at a given index (List packs only). |
void |
readExternal(java.io.ObjectInput in) |
void |
removeInitializationListener(JPack.InitializationListener listener) |
java.lang.String |
toString() |
void |
writeExternal(java.io.ObjectOutput out) |
void |
writeXML(java.io.OutputStream outputStream) |
public static final int PACK_TYPE_LIST
public static final int PACK_TYPE_RECORD
public static final int PACK_TYPE_STRING
String
.public static final int PACK_TYPE_INT
public static final int PACK_TYPE_LONG
public static final int PACK_TYPE_SHORT
public static final int PACK_TYPE_BYTE
public static final int PACK_TYPE_BOOL
public static final int PACK_TYPE_GUID
GUID
.public static final int PACK_TYPE_DOUBLE
public static final int PACK_TYPE_ALIAS
public static final int PACK_TYPE_LOCAL_CHARS
public static final int NETWORK_BYTE_ORDER
public static final int INTEL_BYTE_ORDER
public static final int NATIVE_BYTE_ORDER
public JPack()
public JPack(byte[] initCore)
JPack
from a byte array.initCore
- the JPack
as byte array.public JPack(java.lang.String xml)
public void prepareCache()
public final int countItems()
public final int getType()
public final int getDataSize()
public final byte[] getData()
public final byte[] getData(int byteOrder)
byteOrder
- the byte order. Possible values are: public final int getIndKey(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the specified index.JPack.NoSuchElementException
public final boolean hasItem(int key)
key
- the key to look fortrue
if an item with the specified key is in the pack; false
otherwise.public final int getItemType(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final int getItemSize(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final byte[] getItemData(int key, int type) throws JPack.NoSuchElementException, InvalidTypeException
key
- the item key.type
- the item type.NoSuchElementException
- if there is no item with the specified key.InvalidTypeException
- if the item type doesn't match the specified one.JPack.NoSuchElementException
public final void initializeFromData(byte[] initCore)
initCore
- the pack as byte array.public int getOriginalByteOrder()
public static JPack newRecordPack()
public static JPack newListPack()
public final JPack getPackage(int key) throws JPack.NoSuchElementException
Pack
object (Record packs only).key
- the item key.Pack
object.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final boolean getBoolean(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final byte getByte(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final short getShort(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final short[] getShortArray(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final short[] getShortArrayAt(int index) throws JPack.NoSuchElementException
index
- the item indexNoSuchElementException
- if there is no item at the specified indexJPack.NoSuchElementException
public final byte[] getByteArray(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final boolean[] getBooleanArray(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final int getInt(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final int[] getIntArray(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final long getLong(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final long[] getLongArray(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final long[] getLongArrayAt(int index) throws JPack.NoSuchElementException
index
- the item index.NoSuchElementException
- if there is no item at the specified index.JPack.NoSuchElementException
public final int[] getIntArrayAt(int index) throws JPack.NoSuchElementException
index
- the item index.NoSuchElementException
- if there is no item at the specified index.JPack.NoSuchElementException
public final double[] getDoubleArrayAt(int index) throws JPack.NoSuchElementException
index
- the item index.NoSuchElementException
- if there is no item at the specified index.JPack.NoSuchElementException
public final GUID[] getGUIDArrayAt(int index) throws JPack.NoSuchElementException
index
- the item index.NoSuchElementException
- if there is no item at the specified index.JPack.NoSuchElementException
public final boolean[] getBooleanArrayAt(int index) throws JPack.NoSuchElementException
index
- the item index.NoSuchElementException
- if there is no item at the specified index.JPack.NoSuchElementException
public final byte[] getByteArrayAt(int index) throws JPack.NoSuchElementException
index
- the item index.NoSuchElementException
- if there is no item at the specified index.JPack.NoSuchElementException
public final double getDouble(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final double[] getDoubleArray(int key) throws JPack.NoSuchElementException
key
- the item key.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final GUID getGUID(int key) throws JPack.NoSuchElementException
GUID
object (Record packs only).key
- the item key.GUID
object.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final GUID[] getGUIDArray(int key) throws JPack.NoSuchElementException
GUIDs
(Record packs only).key
- the item key.GUIDs
.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final void putGUIDArray(int key, GUID[] value)
GUIDs
to the pack (Record packs only).key
- the item key.value
- an array of GUIDs
.public final java.lang.String getString(int key) throws JPack.NoSuchElementException
String
(Record packs only).key
- the item key.String
.NoSuchElementException
- if there is no item with the specified key.JPack.NoSuchElementException
public final void deleteItem(int key)
key
- the item key.public final void putItemData(int key, int type, byte[] newItem)
key
- the item key.type
- the item type (see constants above).newItem
- the item value as a byte array.public final void putPackage(int key, JPack pack)
key
- the item key.pack
- the pack to add.public final void putBoolean(int key, boolean value)
key
- the item key.value
- the boolean to add.public final void putByte(int key, byte value)
key
- the item key.value
- the byte to add.public final void putShort(int key, short value)
key
- the item key.value
- the 16-bits integer to add.public final void putInt(int key, int value)
key
- the item key.value
- the 32-bits integer to add.public final void putIntArray(int key, int[] value)
key
- the item key.value
- the array of 32-bits integers to add.public final void putLong(int key, long value)
key
- the item key.value
- the 64-bits integer to add.public final void putLongArray(int key, long[] value)
key
- the item key.value
- the array of 64-bits integers to add.public final void putBooleanArray(int key, boolean[] value)
key
- the item key.value
- the array of booleans to add.public final void putByteArray(int key, byte[] value)
key
- the item key.value
- the array of bytes to add.public final void putShortArray(int key, short[] value)
key
- the item key.value
- the array of 16-bits integers to add.public final void putDouble(int key, double value)
key
- the item key.value
- the double to add.public final void putDoubleArray(int key, double[] value)
key
- the item key.value
- the array of doubles to add.public final void putGUID(int key, GUID value)
GUID
item to the pack (Record packs only).key
- the item key.value
- the GUID
to add.public final void putString(int key, java.lang.String value)
String
item to the pack (Record packs only).key
- the item key.value
- the String
to add.public static int buildKey(java.lang.String s)
s
- the key as a string. This string must contain exactly 4 characters.public java.util.Iterator<JPack> getListItemsIterator()
Iterator
for iterating all contained Packs. This pack must not contain any other types except packs! This method throws an UnsupportedOperationException
when called on a record pack.Iterator.remove()
-support) for iterating all sub-packs of this list packpublic final int getItemTypeAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final int getItemSizeAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final byte[] getItemDataAt(int ulIndex, int type) throws JPack.NoSuchElementException, InvalidTypeException
ulIndex
- the item index.type
- content typeNoSuchElementException
- if there is no item at the given index.InvalidTypeException
- if the item type doesn't match the specified one.JPack.NoSuchElementException
public final JPack getPackageAt(int ulIndex) throws JPack.NoSuchElementException
Pack<code> object (<b>List packs only</b>).
ulIndex
- the item index.Pack<code> object.
NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final boolean getBooleanAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final byte getByteAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final short getShortAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final int getIntAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final long getLongAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final GUID getGuidAt(int ulIndex) throws JPack.NoSuchElementException
GUID
object (List packs only).ulIndex
- the item index.GUID
object.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final double getDoubleAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final java.lang.String getStringAt(int ulIndex) throws JPack.NoSuchElementException
String
object (List packs only).ulIndex
- the item index.String
object.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final void deleteItemAt(int ulIndex) throws JPack.NoSuchElementException
ulIndex
- the item index.NoSuchElementException
- if there is no item at the given index.JPack.NoSuchElementException
public final void putItemDataAt(int type, byte[] ptr)
type
- the item type (see constants above).ptr
- the item value as a byte array.public final void putItemDataAt(int type, byte[] ptr, int ulIndex)
type
- the item type (see constants above).ptr
- the item value as a byte array.ulIndex
- the index where to insert the item.public final void putPackageAt(JPack pack)
Pack
item at the end of the pack (List packs only).pack
- the pack item.public final void putPackageAt(JPack pack, int ulIndex)
Pack
item into the pack at a given index (List packs only).pack
- the pack to add.ulIndex
- the index where to insert the itempublic final void putBooleanAt(boolean value)
value
- the boolean to add.public final void putBooleanAt(boolean value, int ulIndex)
value
- the boolean to add.ulIndex
- the index where to insert the item.public final void putByteAt(byte value)
value
- the byte to add.public final void putByteAt(byte value, int ulIndex)
value
- the byte to add.ulIndex
- the index where to insert the item.public final void putShortAt(short value)
value
- the 16-bits integer to add.public final void putShortAt(short value, int ulIndex)
value
- the 16-bits integer to add.ulIndex
- the index where to insert the item.public final void putIntAt(int value)
value
- the 32-bits integer to add.public final void putIntAt(int value, int ulIndex)
value
- the 32-bits integer to add.ulIndex
- the index where to insert the item.public final void putLongAt(long value)
value
- the 64-bits integer to add.public final void putLongAt(long value, int ulIndex)
value
- the 64-bits integer to add.ulIndex
- the index where to insert the item .public final void putGUIDAt(GUID value)
GUID
item at the end of the pack (List packs only).value
- the GUID
to add.public final void putGUIDAt(GUID value, int ulIndex)
GUID
item into the pack at a given index (List packs only).value
- the GUID
to add.ulIndex
- the index where to insert the item.public final void putDoubleAt(double value)
value
- the double to add.public final void putDoubleAt(double value, int ulIndex)
value
- the double to add.ulIndex
- the index where to insert the item.public final void putStringAt(java.lang.String value)
String
item at the end of the pack (List packs only).value
- the String
to add.public final void putStringAt(java.lang.String value, int ulIndex)
String
item into the pack at a given index (List packs only).value
- the String
to add.ulIndex
- the index where to insert the itempublic java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String getXML()
public void writeXML(java.io.OutputStream outputStream) throws java.io.IOException
java.io.IOException
public static JPack fromJSON(java.lang.String json)
json
- String in valid json format that should be parsed into a JPackjava.lang.IllegalArgumentException
- in case of an invalid JSON Stringpublic void addInitializationListener(JPack.InitializationListener listener)
public void removeInitializationListener(JPack.InitializationListener listener)
public JPack.InitializationListener[] getInitializationListeners()
public boolean equals(JPack pack)
true
if and only if the argument is not null
and is a Pack
object that
represents the same pack as this object.pack
- the pack to comparetrue
if the packs are equal; false
otherwise.public static java.lang.String keyToString(int key)
buildKey(String)
.key
- record pack key valuebuildKey(String)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
in interface java.io.Externalizable
java.io.IOException
java.lang.ClassNotFoundException
www.canto.com
Canto, the Canto logo, the Cumulus logo, and Cumulus are registered trademarks of Canto GmbH, registered in the U.S. and other countries.