ByteArrayListByteSerializerDeserializer
, CharSequenceByteSerializerDeserializer
public interface ByteSerializerDeserializer<V>
InputStream
/OutputStream
(and
FastBufferedInputStream
for fast skipping).Modifier and Type | Field | Description |
---|---|---|
static ByteSerializerDeserializer<byte[]> |
BYTE_ARRAY |
A serializer-deserializer for byte arrays that write the array length using variable-length byte encoding,
and the writes the content of the array.
|
static ByteSerializerDeserializer<java.lang.Integer> |
INTEGER |
A trivial serializer-deserializer for
Integer . |
static ByteSerializerDeserializer<java.lang.Void> |
VOID |
A NOP-serializer-deserializer for Void (only for values).
|
Modifier and Type | Method | Description |
---|---|---|
V |
fromStream(java.io.InputStream is) |
Deserializes an object starting from a given portion of a byte array.
|
void |
skip(FastBufferedInputStream is) |
Skip an object, usually without deserializing it.
|
void |
toStream(V v,
java.io.OutputStream os) |
Serializes an object starting from a given offset of a byte array.
|
static final ByteSerializerDeserializer<java.lang.Void> VOID
static final ByteSerializerDeserializer<java.lang.Integer> INTEGER
Integer
.static final ByteSerializerDeserializer<byte[]> BYTE_ARRAY
V fromStream(java.io.InputStream is) throws java.io.IOException
is
- the input stream from which the object will be deserialized.java.io.IOException
void toStream(V v, java.io.OutputStream os) throws java.io.IOException
v
- the object to be serialized.os
- the output stream that will receive the serialized object.java.io.IOException
void skip(FastBufferedInputStream is) throws java.io.IOException
Note that this method
requires explicitly a FastBufferedInputStream
. As
a result, you can safely use skip()
to
skip the number of bytes required (see the documentation of FastBufferedInputStream.skip(long)
for some elaboration).
Calling this method must be equivalent to calling fromStream(InputStream)
and discarding the result.
is
- the fast buffered input stream from which the next object will be skipped.java.io.IOException