Class ObjectPlusFilesOutputStream
java.lang.Object
java.io.OutputStream
java.io.ObjectOutputStream
org.archive.io.ObjectPlusFilesOutputStream
- All Implemented Interfaces:
Closeable,DataOutput,Flushable,ObjectOutput,ObjectStreamConstants,AutoCloseable
Enhanced ObjectOutputStream which maintains (a stack of) auxiliary
directories and offers convenience methods for serialized objects
to save their related disk files alongside their serialized version.
- Author:
- gojomo
-
Nested Class Summary
Nested classes/interfaces inherited from class java.io.ObjectOutputStream
ObjectOutputStream.PutField -
Field Summary
FieldsFields inherited from interface java.io.ObjectStreamConstants
baseWireHandle, PROTOCOL_VERSION_1, PROTOCOL_VERSION_2, SC_BLOCK_DATA, SC_ENUM, SC_EXTERNALIZABLE, SC_SERIALIZABLE, SC_WRITE_METHOD, STREAM_MAGIC, STREAM_VERSION, SUBCLASS_IMPLEMENTATION_PERMISSION, SUBSTITUTION_PERMISSION, TC_ARRAY, TC_BASE, TC_BLOCKDATA, TC_BLOCKDATALONG, TC_CLASS, TC_CLASSDESC, TC_ENDBLOCKDATA, TC_ENUM, TC_EXCEPTION, TC_LONGSTRING, TC_MAX, TC_NULL, TC_OBJECT, TC_PROXYCLASSDESC, TC_REFERENCE, TC_RESET, TC_STRING -
Constructor Summary
ConstructorsConstructorDescriptionObjectPlusFilesOutputStream(OutputStream out, File topDirectory) Constructor -
Method Summary
Modifier and TypeMethodDescriptionReturn the current auxiliary directory for storing files associated with serialized objects.voidRemove the top subdirectory.voidAdd another subdirectory for any file-capture needs during the current serialization.voidsnapshotAppendOnlyFile(File file) Store a snapshot of an object's supporting file to the current auxiliary directory.Methods inherited from class java.io.ObjectOutputStream
annotateClass, annotateProxyClass, close, defaultWriteObject, drain, enableReplaceObject, flush, putFields, replaceObject, reset, useProtocolVersion, write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeClassDescriptor, writeDouble, writeFields, writeFloat, writeInt, writeLong, writeObject, writeObjectOverride, writeShort, writeStreamHeader, writeUnshared, writeUTF
-
Field Details
-
auxiliaryDirectoryStack
-
-
Constructor Details
-
ObjectPlusFilesOutputStream
Constructor- Parameters:
out-topDirectory-- Throws:
IOException
-
-
Method Details
-
pushAuxiliaryDirectory
Add another subdirectory for any file-capture needs during the current serialization.- Parameters:
dir-
-
popAuxiliaryDirectory
public void popAuxiliaryDirectory()Remove the top subdirectory. -
getAuxiliaryDirectory
Return the current auxiliary directory for storing files associated with serialized objects.- Returns:
- Auxillary directory.
-
snapshotAppendOnlyFile
Store a snapshot of an object's supporting file to the current auxiliary directory. Should only be used for files which are strictly appended-to, because it tries to use a "hard link" where possible (meaning that future edits to the original file's contents will also affect the snapshot). Remembers current file extent to allow a future restore to ignore subsequent appended data.- Parameters:
file-- Throws:
IOException
-