public final class StorageSerialization
extends java.lang.Object
Constructor and Description |
---|
StorageSerialization(Configuration config)
Default constructor with configuration.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
deserialize(byte[] buf) |
java.lang.Object |
deserialize(java.io.DataInput is) |
boolean |
isCompressionEnabled()
Returns true if compression is enabled.
|
byte[] |
serializeKey(java.lang.Object key)
Serializes the key object and returns it as a byte array.
|
void |
serializeKey(java.lang.Object key,
java.io.DataOutput dataOutput)
Serializes the key and writes it into
dataOutput . |
byte[] |
serializeValue(java.lang.Object value)
Serializes the value object and returns it as a byte array.
|
void |
serializeValue(java.lang.Object value,
java.io.DataOutput dataOutput)
Serializes the value and writes it into
dataOutput . |
public StorageSerialization(Configuration config)
Uses Configuration.COMPRESSION_ENABLED
and Configuration.KEY_COMPARATOR
values
from the configuration.
config
- configurationpublic byte[] serializeKey(java.lang.Object key) throws java.io.IOException
key
- key to serializejava.io.IOException
- if an io error occurspublic void serializeKey(java.lang.Object key, java.io.DataOutput dataOutput) throws java.io.IOException
dataOutput
.key
- key to serializedataOutput
- data outputjava.io.IOException
- if an io error occurspublic byte[] serializeValue(java.lang.Object value) throws java.io.IOException
value
- value to serializejava.io.IOException
- if an io error occurspublic void serializeValue(java.lang.Object value, java.io.DataOutput dataOutput) throws java.io.IOException
dataOutput
.value
- value to serializedataOutput
- data outputjava.io.IOException
- if an io error occurspublic boolean isCompressionEnabled()
public java.lang.Object deserialize(byte[] buf) throws java.lang.ClassNotFoundException, java.io.IOException
java.lang.ClassNotFoundException
java.io.IOException
public java.lang.Object deserialize(java.io.DataInput is) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException