public abstract class POPBuffer
extends java.lang.Object
buffer.putByteArray(byteArray);
byte [] deserialized = buffer.getByteArray(buffer.getInt());
| Modifier and Type | Field and Description |
|---|---|
protected MessageHeader |
messageHeader
Each buffer send must contains a message header
|
protected int |
size
Size of the buffer in byte
|
| Constructor and Description |
|---|
POPBuffer()
Default constructor
|
POPBuffer(MessageHeader messageHeader)
Constructor with given values
|
| Modifier and Type | Method and Description |
|---|---|
abstract byte[] |
array() |
static void |
checkAndThrow(int systemErrorCode,
POPBuffer buffer)
Check error code and throw the right exception
|
void |
deserializeReferenceObject(java.lang.Class<?> type,
java.lang.Object obj)
Retrieve an object reference from the buffer
|
abstract MessageHeader |
extractHeader()
Retrieve the message header from the buffer
|
abstract byte |
get()
Retrieve a byte from the buffer
|
<T> T |
getArray(java.lang.Class<T> arrayType)
Retrieve an array from the buffer
|
abstract boolean |
getBoolean()
Retrieve a boolean from the buffer
|
abstract boolean[] |
getBooleanArray(int length)
Retrieve a boolean array from the buffer
|
abstract byte[] |
getByteArray(int length)
Retrieve a byte array from the buffer
|
abstract char |
getChar()
Retrieve a char from the buffer
|
abstract char[] |
getCharArray(int length)
Retrieve a char array from the buffer
|
abstract double |
getDouble()
Retrieve a double from the buffer
|
abstract double[] |
getDoubleArray(int length)
Retrieve a double array from the buffer
|
abstract float |
getFloat()
Retrieve a float from the buffer
|
abstract float[] |
getFloatArray(int length)
Retrieve a float array from the buffer
|
MessageHeader |
getHeader()
Get the message header associated with this buffer
|
abstract int |
getInt()
Retrieve a int from the buffer
|
abstract int[] |
getIntArray(int length)
Retrieve a int array from the buffer
|
abstract long |
getLong()
Retrieve a long from the buffer
|
abstract long[] |
getLongArray(int length)
Retrieve a long array from the buffer
|
abstract short |
getShort()
Retrieve a short from the buffer
|
abstract short[] |
getShortArray(int length)
Retrieve a short array from the buffer
|
abstract java.lang.String |
getString()
Retrieve a string from the buffer
|
abstract int |
getTranslatedInteger(byte[] value)
Get a integer value of the byte array
|
java.lang.Object |
getValue(java.lang.Class<?> c)
Retrieve an object from the buffer
|
java.lang.Object |
getValue(Combox sourceCombox,
java.lang.Class<?> c)
Retrieve an object from the buffer
|
abstract int |
packMessageHeader()
Pack the message header into the buffer
|
abstract void |
put(byte value)
Insert a byte in the buffer
|
abstract void |
put(byte[] data)
Insert a byte array into the buffer
|
abstract void |
put(byte[] data,
int offset,
int length)
Insert a byte array into a specific place in the buffer
|
void |
putArray(java.lang.Object o)
Insert an array into the buffer
|
abstract void |
putBoolean(boolean value)
Insert a boolean in the buffer
|
abstract void |
putBooleanArray(boolean[] value)
Insert a boolean array into the buffer
|
abstract void |
putByteArray(byte[] value)
Insert a byte array into the buffer
|
abstract void |
putChar(char value)
Insert a char into the buffer
|
abstract void |
putCharArray(char[] value)
Insert a char array into the buffer
|
abstract void |
putDouble(double value)
Insert a double value into the buffer
|
abstract void |
putDoubleArray(double[] value)
Insert a double array into the buffer
|
abstract void |
putFloat(float value)
Insert a float value into the buffer
|
abstract void |
putFloatArray(float[] value)
Insert a float array into the buffer
|
abstract void |
putInt(int value)
Insert a int into the buffer
|
abstract void |
putIntArray(int[] value)
Insert a int array into the buffer
|
abstract void |
putLong(long value)
Insert a long into the buffer
|
abstract void |
putLongArray(long[] value)
Insert a long array into the buffer
|
abstract void |
putShort(short value)
Insert a short into the buffer
|
abstract void |
putShortArray(short[] value)
Insert a short array into the buffer
|
abstract void |
putString(java.lang.String value)
Insert a string into the buffer
|
void |
putValue(java.lang.Object o,
java.lang.Class<?> c)
Insert an object into the buffer
|
abstract void |
reset()
Erase the buffer and set the pointer to the beginning
|
abstract void |
resetToReceive()
Reset the buffer before reception of a new message
|
void |
serializeReferenceObject(java.lang.Class<?> type,
java.lang.Object obj)
Insert an object reference into the buffer
|
void |
setHeader(MessageHeader messageHeader)
Associate a message header with this buffer
|
int |
size()
Get the current size of the buffer
|
java.lang.String |
toCharString()
Return an empty string
|
java.lang.String |
toIntString()
Return an empty string
|
protected MessageHeader messageHeader
protected int size
public POPBuffer()
public POPBuffer(MessageHeader messageHeader)
messageHeader - Message header to be associated with this bufferpublic abstract void reset()
public abstract void put(byte value)
value - byte value to insertpublic abstract void putBoolean(boolean value)
value - boolean value to insertpublic abstract void putChar(char value)
value - char value to insertpublic abstract void putInt(int value)
value - int value to insertpublic abstract void putLong(long value)
value - long value to insertpublic abstract void putShort(short value)
value - short value to insertpublic abstract void putFloat(float value)
value - float value to insertpublic abstract void putDouble(double value)
value - double value to insertpublic abstract void put(byte[] data)
data - byte array to insertpublic abstract void put(byte[] data,
int offset,
int length)
data - byte array to insertoffset - offset for insertionlength - length of the arraypublic abstract void putByteArray(byte[] value)
value - byte array to insertpublic abstract void putCharArray(char[] value)
value - char array to insertpublic abstract void putBooleanArray(boolean[] value)
value - boolean array to insertpublic abstract void putIntArray(int[] value)
value - int array to insertpublic abstract void putShortArray(short[] value)
value - short array to insertpublic abstract void putLongArray(long[] value)
value - long array to insertpublic abstract void putFloatArray(float[] value)
value - float array to insertpublic abstract void putDoubleArray(double[] value)
value - double array to insertpublic abstract byte[] getByteArray(int length)
length - length of the array to retrievepublic abstract char[] getCharArray(int length)
length - length of the array to retrievepublic abstract boolean[] getBooleanArray(int length)
length - length of the array to retrievepublic abstract int[] getIntArray(int length)
length - length of the array to retrievepublic abstract long[] getLongArray(int length)
length - length of the array to retrievepublic abstract short[] getShortArray(int length)
length - length of the array to retrievepublic abstract float[] getFloatArray(int length)
length - length of the array to retrievepublic abstract double[] getDoubleArray(int length)
length - length of the array to retrievepublic abstract void putString(java.lang.String value)
value - string value to insertpublic abstract byte get()
public abstract boolean getBoolean()
public abstract char getChar()
public abstract int getInt()
public abstract long getLong()
public abstract short getShort()
public abstract float getFloat()
public abstract double getDouble()
public abstract java.lang.String getString()
public abstract byte[] array()
public abstract int getTranslatedInteger(byte[] value)
value - The byte array to translatepublic abstract MessageHeader extractHeader()
public abstract void resetToReceive()
public abstract int packMessageHeader()
public void setHeader(MessageHeader messageHeader)
messageHeader - Message header to be associated with this bufferpublic MessageHeader getHeader()
public int size()
public java.lang.Object getValue(java.lang.Class<?> c)
throws POPException
c - Class of the object to retrievePOPException - thrown if the deserialization process is not going wellpublic java.lang.Object getValue(Combox sourceCombox, java.lang.Class<?> c) throws POPException
c - Class of the object to retrievePOPException - thrown if the deserialization process is not going wellpublic void putValue(java.lang.Object o,
java.lang.Class<?> c)
throws POPException
o - Object to be insertedc - Class of the object to be insertedPOPException - thrown if the serialization process is not going wellpublic void putArray(java.lang.Object o)
throws POPException
o - Array to be insertedPOPException - thrown if the serialization process is not going wellpublic <T> T getArray(java.lang.Class<T> arrayType)
throws POPException
T - the type of returnarrayType - Class of the array to retrievePOPException - thrown if the serialization process is not going wellpublic void serializeReferenceObject(java.lang.Class<?> type,
java.lang.Object obj)
throws POPException
type - Class of the objectobj - Object to be insertedPOPException - thrown if the serialization process is not going wellpublic void deserializeReferenceObject(java.lang.Class<?> type,
java.lang.Object obj)
throws POPException
type - Class of the objectobj - Object to be retrievedPOPException - thrown if the deserialization process is not going wellpublic static void checkAndThrow(int systemErrorCode,
POPBuffer buffer)
throws POPException
systemErrorCode - Code of the errorbuffer - Buffer from which retrieve the additional informationsPOPException - thrown if any problem occurredpublic java.lang.String toIntString()
public java.lang.String toCharString()