|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.helidb.lang.serializer.ByteSerializer
public class ByteSerializer
A Serializer for Byte values. Every Byte
value serialized by this object is represented as a byte array of length one.
This serializer does not handle null values.
The singleton instance INSTANCE may be used instead of creating a
new object of this class.
Byte,
UnsignedByteSerializer| Field Summary | |
|---|---|
static int |
DATA_SIZE
One byte. |
static ByteSerializer |
INSTANCE
The singleton instance. |
| Constructor Summary | |
|---|---|
ByteSerializer()
|
|
| Method Summary | |
|---|---|
int |
getSerializedSize()
If the serialized data produced by this serializer always is of the same size, return that size (in number of bytes). |
Byte |
interpret(byte[] barr)
Interpret the data in the byte array to an object of the type
handled by the Serializer implementation. |
Byte |
interpret(byte[] barr,
int offset,
int length)
Interpret the data in the byte array to an object of the type
handled by the Serializer implementation. |
boolean |
isNullValuesPermitted()
Does this serializer permit null values? |
Byte |
read(InputStream is,
int dataSize)
Read a value from the InputStream. |
Byte |
read(RandomAccess ra,
int dataSize)
Read a value from the RandomAccess' current position. |
Byte |
readByte(InputStream is)
Read a Byte value from the current position of the InputStream. |
Byte |
readByte(RandomAccess ra)
Read a Byte value from the current position of the RandomAccess. |
byte[] |
serialize(Byte value)
Serialize the supplied object into a new byte array. |
int |
serialize(Byte value,
byte[] arr,
int offset)
Serialize the supplied object into the byte array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ByteSerializer INSTANCE
public static final int DATA_SIZE
| Constructor Detail |
|---|
public ByteSerializer()
| Method Detail |
|---|
public Byte interpret(byte[] barr,
int offset,
int length)
Serializerbyte array to an object of the type
handled by the Serializer implementation.
interpret in interface Serializer<Byte>barr - The byte array containing the data.offset - The start position of the data.length - The length of the data.
Serializer.interpret(byte[])public Byte interpret(byte[] barr)
Serializerbyte array to an object of the type
handled by the Serializer implementation.
interpret in interface Serializer<Byte>barr - The byte array containing the data.
Serializer.interpret(byte[], int, int)
public int serialize(Byte value,
byte[] arr,
int offset)
Serializerbyte array.
serialize in interface Serializer<Byte>value - The object to serialize.arr - The byte array to serialize it to.offset - The start position to write data at in the byte array.
public byte[] serialize(Byte value)
Serializerbyte array.
serialize in interface Serializer<Byte>value - The object to serialize.
byte array.public int getSerializedSize()
Serializer-1 is
returned.
getSerializedSize in interface Serializer<Byte>public boolean isNullValuesPermitted()
Serializernull values?
isNullValuesPermitted in interface Serializer<Byte>false, always.
public Byte readByte(RandomAccess ra)
throws NotEnoughDataException,
WrappedIOException
Byte value from the current position of the RandomAccess.
ra - The RandomAccess to read from. The current position of
this is incremented by 1 bytes.
Byte value.
DatabaseException - If 1 bytes cannot be read.
WrappedIOException - On I/O errors.
NotEnoughDataException
public Byte readByte(InputStream is)
throws NotEnoughDataException,
WrappedIOException
Byte value from the current position of the InputStream.
is - The InputStream to read from. The current position of
the stream is incremented by 1 bytes.
Byte value.
NotEnoughDataException - If 1 bytes cannot be
read.
WrappedIOException - If an IOException is encountered while
reading data.
public Byte read(RandomAccess ra,
int dataSize)
SerializerRandomAccess' current position. The
position in the RandomAccess is incremented by size
bytes.
read in interface Serializer<Byte>ra - The RandomAccess to read from.dataSize - The size of the value.
public Byte read(InputStream is,
int dataSize)
SerializerInputStream.
read in interface Serializer<Byte>is - The InputStream to read from.dataSize - The size of the value.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||