public class ShortSerializer extends Serializer
Constructor and Description |
---|
ShortSerializer() |
ShortSerializer(java.lang.Boolean optimizePositive) |
Modifier and Type | Method and Description |
---|---|
static short |
get(java.nio.ByteBuffer buffer,
boolean optimizePositive)
Reads a short from the buffer that was written with
put(ByteBuffer, short, boolean) . |
static short |
put(java.nio.ByteBuffer buffer,
short value,
boolean optimizePositive)
Writes the specified short to the buffer as a byte or short depending on the size of the number.
|
java.lang.Short |
readObjectData(java.nio.ByteBuffer buffer,
java.lang.Class type)
Reads an object from the buffer.
|
void |
writeObjectData(java.nio.ByteBuffer buffer,
java.lang.Object object)
Writes the object to the buffer.
|
isFinal, newInstance, readObject, setCanBeNull, writeObject
public ShortSerializer()
public ShortSerializer(java.lang.Boolean optimizePositive)
optimizePositive
- If true, writes 1 byte if 0 <= value <= 254 and 3 bytes otherwise (default). If false, writes 1 byte
if -127 <= value <= 127 and 3 bytes otherwise. If null, 2 bytes are always written.public java.lang.Short readObjectData(java.nio.ByteBuffer buffer, java.lang.Class type)
Serializer
readObjectData
in class Serializer
public void writeObjectData(java.nio.ByteBuffer buffer, java.lang.Object object)
Serializer
writeObjectData
in class Serializer
object
- Cannot be null.public static short put(java.nio.ByteBuffer buffer, short value, boolean optimizePositive)
optimizePositive
- If true, writes 1 byte if 0 <= value <= 254 and 3 bytes otherwise. If false, writes 1 byte if -127
<= value <= 127 and 3 bytes otherwise.public static short get(java.nio.ByteBuffer buffer, boolean optimizePositive)
put(ByteBuffer, short, boolean)
.