public interface ProgressiveSerialization extends AutoCloseable
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.
|
<T> void |
setDeserializer(Class<T> deserializedType,
ProgressiveDeserializer<T> progressiveDeserializer)
Specify deserializer to reconstruct the storage.
|
void close() throws Exception
close
in interface AutoCloseable
Exception
<T> void setDeserializer(Class<T> deserializedType, ProgressiveDeserializer<T> progressiveDeserializer)
ObjectOutputStream
with a Deserializer
instance which
delegates to the passed progressiveDeserializer
.
Must be invoked before accessing #getDataOutput()
.T
- Reconstructed storage typedeserializedType
- Reconstructed storage typeprogressiveDeserializer
- Deserializer to reconstruct the object<T extends Serializable> Consumer<T> addDeferredAttribute(String name, Class<T> type, T initialValue)
RandomAccessFile
will write a placeholder which will be updated
later.T
- 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.IllegalStateException
- when invoked after #getDataOutput()
or after close()
or when the
serialized size of the stored values changed.ObjectOutputStream getObjectOutputStream()