|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.msgpack.MessagePack
public class MessagePack
This is basic class to use MessagePack for Java. It creates serializers and deserializers for objects of classes.
See Quick Start for Java on MessagePack wiki.
| Constructor Summary | |
|---|---|
MessagePack()
|
|
MessagePack(MessagePack msgpack)
|
|
| Method Summary | ||
|---|---|---|
|
convert(Value v,
Class<T> c)
Converts Value object to object specified class. |
|
|
convert(Value v,
T to)
Converts specified Value object to object. |
|
BufferPacker |
createBufferPacker()
Returns serializer that enables serializing objects into buffer. |
|
BufferPacker |
createBufferPacker(int bufferSize)
Returns serializer that enables serializing objects into buffer. |
|
BufferUnpacker |
createBufferUnpacker()
Returns empty deserializer that enables deserializing buffer. |
|
BufferUnpacker |
createBufferUnpacker(byte[] bytes)
Returns deserializer that enables deserializing buffer. |
|
BufferUnpacker |
createBufferUnpacker(byte[] bytes,
int off,
int len)
Returns deserializer that enables deserializing buffer. |
|
BufferUnpacker |
createBufferUnpacker(ByteBuffer buffer)
Returns deserializer that enables deserializing buffer. |
|
Packer |
createPacker(OutputStream out)
Returns serializer that enables serializing objects into OutputStream object. |
|
Unpacker |
createUnpacker(InputStream in)
Returns deserializer that enables deserializing InputStream object. |
|
|
lookup(Class<T> type)
Looks up a Template object, which is
serializer/deserializer associated by specified class. |
|
static byte[] |
pack(Object v)
Deprecated. write(Object) |
|
static void |
pack(OutputStream out,
Object v)
Deprecated. write(OutputStream, Object) |
|
static
|
pack(OutputStream out,
T v,
Template<T> template)
Deprecated. write(OutputStream, Object, Template) |
|
static
|
pack(T v,
Template<T> template)
Deprecated. write(Object, Template) |
|
Value |
read(byte[] bytes)
Deserializes specified byte array to Value
object. |
|
|
read(byte[] bytes,
Class<T> c)
Deserializes byte array to object of specified class. |
|
Value |
read(byte[] bytes,
int off,
int len)
Deserializes byte array to Value object. |
|
|
read(byte[] bytes,
T v)
Deserializes byte array to object. |
|
|
read(byte[] bytes,
Template<T> tmpl)
Deserializes byte array to object according to template. |
|
|
read(byte[] bytes,
T v,
Template<T> tmpl)
Deserializes byte array to object according to specified template. |
|
Value |
read(ByteBuffer buffer)
Deserializes ByteBuffer object to
Value object. |
|
|
read(ByteBuffer b,
Class<T> c)
Deserializes buffer to object of specified class. |
|
|
read(ByteBuffer b,
T v)
Deserializes buffer to object. |
|
|
read(ByteBuffer b,
Template<T> tmpl)
Deserializes buffer to object according to template. |
|
|
read(ByteBuffer b,
T v,
Template<T> tmpl)
Deserializes buffer to object according to template. |
|
Value |
read(InputStream in)
Deserializes input stream to Value object. |
|
|
read(InputStream in,
Class<T> c)
Deserializes input stream to object of specified class. |
|
|
read(InputStream in,
T v)
Deserializes input stream to object. |
|
|
read(InputStream in,
Template<T> tmpl)
Deserializes input stream to object according to template. |
|
|
read(InputStream in,
T v,
Template<T> tmpl)
Deserializes input stream to object according to template |
|
void |
register(Class<?> type)
Registers Template object for objects of
specified class. |
|
|
register(Class<T> type,
Template<T> template)
Registers specified Template object
associated by class. |
|
void |
setClassLoader(ClassLoader cl)
|
|
|
unconvert(T v)
Unconverts specified object to Value object. |
|
static Value |
unpack(byte[] bytes)
Deprecated. |
|
static
|
unpack(byte[] bytes,
Class<T> klass)
Deprecated. read(byte[], Class) |
|
static
|
unpack(byte[] bytes,
T to)
Deprecated. |
|
static
|
unpack(byte[] bytes,
Template<T> template)
Deprecated. |
|
static
|
unpack(byte[] bytes,
Template<T> template,
T to)
Deprecated. |
|
static Value |
unpack(InputStream in)
Deprecated. read(InputStream) |
|
static
|
unpack(InputStream in,
Class<T> klass)
Deprecated. read(InputStream, Class) |
|
static
|
unpack(InputStream in,
T to)
Deprecated. read(InputStream, Object) |
|
static
|
unpack(InputStream in,
Template<T> tmpl)
Deprecated. |
|
static
|
unpack(InputStream in,
Template<T> tmpl,
T to)
Deprecated. |
|
void |
unregister()
Unregisters all Template objects that have
been registered in advance. |
|
boolean |
unregister(Class<?> type)
Unregisters Template object for objects of
specified class. |
|
|
write(OutputStream out,
T v)
Serializes specified object to output stream. |
|
|
write(OutputStream out,
T v,
Template<T> template)
Serializes object to output stream by specified template. |
|
|
write(T v)
Serializes specified object. |
|
|
write(T v,
Template<T> template)
Serializes specified object. |
|
byte[] |
write(Value v)
Serializes Value object to byte array. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MessagePack()
public MessagePack(MessagePack msgpack)
msgpack - | Method Detail |
|---|
public void setClassLoader(ClassLoader cl)
cl - public Packer createPacker(OutputStream out)
OutputStream object.
out - output stream
public BufferPacker createBufferPacker()
public BufferPacker createBufferPacker(int bufferSize)
bufferSize - initial size of buffer
public Unpacker createUnpacker(InputStream in)
InputStream object.
in - input stream
public BufferUnpacker createBufferUnpacker()
public BufferUnpacker createBufferUnpacker(byte[] bytes)
bytes - input byte array
public BufferUnpacker createBufferUnpacker(byte[] bytes,
int off,
int len)
bytes - off - len -
public BufferUnpacker createBufferUnpacker(ByteBuffer buffer)
buffer - input ByteBuffer object
public <T> byte[] write(T v)
throws IOException
v - serialized object
IOException
public <T> byte[] write(T v,
Template<T> template)
throws IOException
v - template -
IOException
public <T> void write(OutputStream out,
T v)
throws IOException
out - output streamv - serialized object
IOException
public <T> void write(OutputStream out,
T v,
Template<T> template)
throws IOException
out - output streamv - serialized objecttemplate - serializer/deserializer for the object
IOException
public byte[] write(Value v)
throws IOException
Value object to byte array.
v - serialized Value object
IOException
public Value read(byte[] bytes)
throws IOException
Value
object.
bytes - input byte array
IOException
public Value read(byte[] bytes,
int off,
int len)
throws IOException
Value object.
bytes - off - len -
IOException
public Value read(ByteBuffer buffer)
throws IOException
ByteBuffer object to
Value object.
buffer - input buffer
IOException
public Value read(InputStream in)
throws IOException
Value object.
in - input stream
Value object
IOException
public <T> T read(byte[] bytes,
T v)
throws IOException
bytes - input byte arrayv -
IOException
public <T> T read(byte[] bytes,
Template<T> tmpl)
throws IOException
bytes - input byte arraytmpl - template
IOException
public <T> T read(byte[] bytes,
Class<T> c)
throws IOException
bytes - input byte arrayc -
IOException
public <T> T read(byte[] bytes,
T v,
Template<T> tmpl)
throws IOException
bytes - input byte arrayv - tmpl - template
IOException
public <T> T read(ByteBuffer b,
T v)
throws IOException
b - input ByteBuffer objectv -
IOException
public <T> T read(ByteBuffer b,
Template<T> tmpl)
throws IOException
b - input buffer objecttmpl -
IOException
public <T> T read(ByteBuffer b,
Class<T> c)
throws IOException
b - c -
IOException
public <T> T read(ByteBuffer b,
T v,
Template<T> tmpl)
throws IOException
b - input buffer objectv - tmpl -
IOException
public <T> T read(InputStream in,
T v)
throws IOException
in - input streamv -
IOException
public <T> T read(InputStream in,
Template<T> tmpl)
throws IOException
in - input streamtmpl -
IOException
public <T> T read(InputStream in,
Class<T> c)
throws IOException
in - c -
IOException
public <T> T read(InputStream in,
T v,
Template<T> tmpl)
throws IOException
in - input streamv - tmpl -
IOException
public <T> T convert(Value v,
T to)
throws IOException
Value object to object.
v - to -
IOException
public <T> T convert(Value v,
Class<T> c)
throws IOException
Value object to object specified class.
v - c -
IOException
public <T> Value unconvert(T v)
throws IOException
Value object.
v -
IOExceptionpublic void register(Class<?> type)
Template object for objects of
specified class. Template object is a pair of serializer and
deserializer for object serialization. It is generated automatically.
type -
public <T> void register(Class<T> type,
Template<T> template)
Template object
associated by class.
type - template - register(Class)public boolean unregister(Class<?> type)
Template object for objects of
specified class.
type -
public void unregister()
Template objects that have
been registered in advance.
public <T> Template<T> lookup(Class<T> type)
Template object, which is
serializer/deserializer associated by specified class.
type -
@Deprecated
public static byte[] pack(Object v)
throws IOException
write(Object)
v -
IOException
@Deprecated
public static void pack(OutputStream out,
Object v)
throws IOException
write(OutputStream, Object)
out - v -
IOException
@Deprecated
public static <T> byte[] pack(T v,
Template<T> template)
throws IOException
write(Object, Template)
v - template -
IOException
@Deprecated
public static <T> void pack(OutputStream out,
T v,
Template<T> template)
throws IOException
write(OutputStream, Object, Template)
out - v - template -
IOException
@Deprecated
public static Value unpack(byte[] bytes)
throws IOException
bytes -
IOException
@Deprecated
public static <T> T unpack(byte[] bytes,
Template<T> template)
throws IOException
IOException
@Deprecated
public static <T> T unpack(byte[] bytes,
Template<T> template,
T to)
throws IOException
IOException
@Deprecated
public static <T> T unpack(byte[] bytes,
Class<T> klass)
throws IOException
read(byte[], Class)
bytes - klass -
IOException
@Deprecated
public static <T> T unpack(byte[] bytes,
T to)
throws IOException
bytes - to -
IOException
@Deprecated
public static Value unpack(InputStream in)
throws IOException
read(InputStream)
Value object.
in -
IOException
@Deprecated
public static <T> T unpack(InputStream in,
Template<T> tmpl)
throws IOException,
MessageTypeException
in - tmpl -
IOException
MessageTypeException
@Deprecated
public static <T> T unpack(InputStream in,
Template<T> tmpl,
T to)
throws IOException,
MessageTypeException
in - tmpl - to -
IOException
MessageTypeException
@Deprecated
public static <T> T unpack(InputStream in,
Class<T> klass)
throws IOException
read(InputStream, Class)
in - klass -
IOException
@Deprecated
public static <T> T unpack(InputStream in,
T to)
throws IOException
read(InputStream, Object)
in - to -
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||