T - type to be marshalled or unmarshalledpublic abstract class Marshaller<T> extends Object implements Serializable
T into bytes and back.| Constructor and Description |
|---|
Marshaller() |
| Modifier and Type | Method and Description |
|---|---|
abstract T |
fromBytes(ByteBuffer b)
Returns the object whose serialized representation is in
b between
b.position() and b.limit(). |
abstract ByteBuffer |
toBytes(T object)
Returns a new
ByteBuffer b with a serialized representation
of object between b.position() and b.limit(). |
public abstract ByteBuffer toBytes(T object)
ByteBuffer b with a serialized representation
of object between b.position() and b.limit().
b.order() is undefined.public abstract T fromBytes(ByteBuffer b)
b between
b.position() and b.limit(). The value of b.order()
when the method is called is undefined, and this method may modify it as
well as b.position() and b.limit().
The method may throw a RuntimeException if it determines that the
sequence of bytes in b was not generated by toBytes(T). This
includes corrupted data as well as trailing bytes.
Copyright © 2015 Google. All rights reserved.