|
Configuration Platform SDK 7.6 API Reference | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.genesyslab.platform.commons.collections.TKVSerializer
This class contains methods to convert the list to/from its binary representation (in TKV binary format).
Constructor Summary | |
TKVSerializer()
|
Method Summary | |
static KeyValueCollection |
deserialize(byte[] bytes)
Unpacks TKV list from byte array. |
static KeyValueCollection |
deserialize(byte[] bytes,
boolean getLen)
Unpacks TKV list from byte array. |
static KeyValueCollection |
deserialize(byte[] bytes,
java.lang.String encoding)
Unpacks TKV list from byte array. |
static KeyValueCollection |
deserialize(byte[] bytes,
java.lang.String encoding,
boolean getLen)
Unpacks TKV list from byte array. |
static KeyValueCollection |
deserialize(byte[] bytes,
java.lang.String encoding,
int offset,
int length,
boolean readLen)
Unpacks TKV list from byte array. |
static KeyValueCollection |
deserialize(java.io.InputStream in)
Reads packed TKV list from OutputStream and unpacks it. |
static KeyValueCollection |
deserialize(java.io.InputStream in,
java.lang.String encoding,
boolean readLen)
Reads packed TKV list from OutputStream and unpacks it. |
static byte[] |
getBytes(KeyValueCollection list)
Packs the list and returns it as byte array. |
static byte[] |
getBytes(KVList list,
java.lang.String encoding)
Packs the list and returns it as byte array. |
static byte[] |
getBytes(KVList list,
java.lang.String encoding,
boolean useLen)
Packs the list and returns it as byte array. |
static void |
serialize(KVList list,
java.io.OutputStream out)
Packs the list and writes it to OutputStream . |
static void |
serialize(KVList list,
java.io.OutputStream out,
java.lang.String encoding,
boolean writeLen)
Packs the list and writes it to OutputStream . |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public TKVSerializer()
Method Detail |
public static KeyValueCollection deserialize(java.io.InputStream in) throws java.io.IOException, DataFormatException
OutputStream
and unpacks it.
To create strings from bytes uses platform default encoding.
in
- the stream to read list from
java.io.IOException
- if some IO problems occur
DataFormatException
- if stream is invalidpublic static KeyValueCollection deserialize(java.io.InputStream in, java.lang.String encoding, boolean readLen) throws java.io.IOException, DataFormatException
OutputStream
and unpacks it.
To create strings from bytes uses supplied encoding. If encoding is
null than default platform encoding will be used.
in
- the stream to read list fromencoding
- the encoding for byte to string conversionreadLen
- if true - length bytes are expected
java.io.IOException
- if some IO problems occur
DataFormatException
- if byte array is invalidpublic static KeyValueCollection deserialize(byte[] bytes) throws DataFormatException
bytes
- bytes to unpack list from
DataFormatException
- if byte array is invalidpublic static KeyValueCollection deserialize(byte[] bytes, boolean getLen) throws DataFormatException
bytes
- bytes to unpack list fromgetLen
- if true - length bytes are expected
DataFormatException
- if byte array is invalidpublic static KeyValueCollection deserialize(byte[] bytes, java.lang.String encoding) throws DataFormatException, java.io.UnsupportedEncodingException
bytes
- bytes to unpack list fromencoding
- the encoding for byte to string conversion
DataFormatException
- if byte array is invalid
java.io.UnsupportedEncodingException
- if encoding is unsupportedpublic static KeyValueCollection deserialize(byte[] bytes, java.lang.String encoding, boolean getLen) throws DataFormatException, java.io.UnsupportedEncodingException
bytes
- bytes to unpack list fromencoding
- the encoding for byte to string conversiongetLen
- if true - length bytes are expected
DataFormatException
- if byte array is invalid
java.io.UnsupportedEncodingException
- if encoding is unsupportedpublic static KeyValueCollection deserialize(byte[] bytes, java.lang.String encoding, int offset, int length, boolean readLen) throws DataFormatException, java.io.UnsupportedEncodingException
bytes
- bytes to unpack list fromencoding
- the encoding for byte to string conversionoffset
- offset in array to read fromlength
- number of bytes to readreadLen
- if true - length bytes are expected
DataFormatException
- if byte array is invalid
java.io.UnsupportedEncodingException
- if encoding is unsupportedpublic static void serialize(KVList list, java.io.OutputStream out) throws java.io.IOException
OutputStream
.
This method will use default encoding to convert strings
to bytes
list
- List to serializeout
- stream to write the list to
java.io.IOException
- if some IO problems occurpublic static void serialize(KVList list, java.io.OutputStream out, java.lang.String encoding, boolean writeLen) throws java.io.IOException
OutputStream
. To convert
strings to bytes this method will use specified encoding
.
If encoding is null than default platform encoding will be used.
list
- List to serializeout
- stream to write the list toencoding
- Encoding to convert stringswriteLen
- if true - length bytes are written
java.io.UnsupportedEncodingException
- if encoding is unsupported
java.io.IOException
- if some IO problems occurpublic static byte[] getBytes(KeyValueCollection list)
list
- List to serialize
public static byte[] getBytes(KVList list, java.lang.String encoding) throws java.io.UnsupportedEncodingException
encoding
.
If encoding is null than default platform encoding will be used.
list
- List to serializeencoding
- Encoding to convert strings
java.io.UnsupportedEncodingException
- if wrong encoding is specifiedpublic static byte[] getBytes(KVList list, java.lang.String encoding, boolean useLen) throws java.io.UnsupportedEncodingException
encoding
.
If encoding is null than default platform encoding will be used.
list
- List to serializeencoding
- Encoding to convert stringsuseLen
- if true - buffer contains length bytes for the list
java.io.UnsupportedEncodingException
- if wrong encoding is specified
|
Configuration Platform SDK 7.6 API Reference | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |