public class ProgressiveSerializationImpl extends Object implements ProgressiveSerialization
ProgressiveSerialization over FileOutputStream.
This class is responsible to create a Deserializer conform binary file over ProgressiveSerialization
interface.| Modifier and Type | Class and Description |
|---|---|
static class |
ProgressiveSerializationImpl.DeserializerImpl<T>
Deserializer.
|
| Constructor and Description |
|---|
ProgressiveSerializationImpl(File file,
int buffer,
boolean collectStats) |
| Modifier and Type | Method and Description |
|---|---|
<T extends Serializable> |
addDeferredAttribute(String name,
Class<T> type,
T initialValue)
Specify a named attribute.
|
void |
close()
Close the underlying resource and write retained index data.
|
ObjectOutputStream |
getObjectOutputStream()
Get output to write remainder data.
|
long |
getWrittenBytes() |
<T> void |
setDeserializer(Class<T> deserializedType,
ProgressiveDeserializer<T> progressiveDeserializer)
Specify deserializer to reconstruct the storage.
|
public ProgressiveSerializationImpl(File file, int buffer, boolean collectStats) throws IOException
IOExceptionpublic long getWrittenBytes()
public void close()
throws IOException
ProgressiveSerializationclose in interface ProgressiveSerializationclose in interface AutoCloseableIOExceptionpublic <T> void setDeserializer(Class<T> deserializedType, ProgressiveDeserializer<T> progressiveDeserializer)
ProgressiveSerializationObjectOutputStream with a Deserializer instance which
delegates to the passed progressiveDeserializer.
Must be invoked before accessing #getDataOutput().setDeserializer in interface ProgressiveSerializationT - Reconstructed storage typedeserializedType - Reconstructed storage typeprogressiveDeserializer - Deserializer to reconstruct the objectpublic <T extends Serializable> Consumer<T> addDeferredAttribute(String name, Class<T> type, T initialValue)
ProgressiveSerializationRandomAccessFile will write a placeholder which will be updated
later.addDeferredAttribute in interface ProgressiveSerializationT - Typename - Unique name of the attributetype - TypeinitialValue - Initial value to be stored. Any subsequent updates of the value must have exactly the
same serialized size.Consumer to update value during the serialization.public ObjectOutputStream getObjectOutputStream()
ProgressiveSerializationgetObjectOutputStream in interface ProgressiveSerialization