goodsjpi
Interface RawBinaryFactory

All Known Implementing Classes:
SerializableObjectFactory

public interface RawBinaryFactory

Interace of factory for packing/unpacking raw binary objects


Method Summary
 int pack(java.lang.Object obj, byte[] arr, int off)
          Pack raw binary object to byte array
 int size(java.lang.Object obj)
          Get size of raw binary object in bytes
 boolean supports(java.lang.Class cls)
          Check if specified las supported by thisd factory
 java.lang.Object unpack(java.lang.Class cls, byte[] arr, int off, int size)
          Unpack raw binary object
 

Method Detail

size

public int size(java.lang.Object obj)
Get size of raw binary object in bytes

Parameters:
obj - raw binary object
Returns:
size of packed raw binary object

pack

public int pack(java.lang.Object obj,
                byte[] arr,
                int off)
Pack raw binary object to byte array

Parameters:
obj - raw binary object
arr - array to store packed image of raw binary object
off - offset in the array where object should be packed
Returns:
bumer of bytes in packed object image. It should be the same as returned by RawBinary.size method.

unpack

public java.lang.Object unpack(java.lang.Class cls,
                               byte[] arr,
                               int off,
                               int size)
Unpack raw binary object

Parameters:
cls - class of raw binary object
arr - array containing packed raw binary object
off - offset of packed binary object in the array
size - size of packed binary object
Returns:
created raw binary object with unpacked content

supports

public boolean supports(java.lang.Class cls)
Check if specified las supported by thisd factory

Parameters:
cls - raw binary object class
Returns:
true if factory is able to pack/unpack instances of these class