Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.archive.io
Class ObjectPlusFilesInputStream

    java.lang.Object
      java.io.InputStream
          java.io.ObjectInputStream
              org.archive.io.ObjectPlusFilesInputStream

All Implemented Interfaces:
  java.io.Closeable, java.io.DataInput, java.io.ObjectInput, java.io.ObjectStreamConstants

    public class ObjectPlusFilesInputStream

extends java.io.ObjectInputStream

Enhanced ObjectOutputStream with support for restoring files that had been saved, in parallel with object serialization.

Author:
  gojomo

Nested Class Summary

Nested classes/interfaces inherited from class java.io.ObjectInputStream
`java.io.ObjectInputStream.GetField`

Field Summary
`(package private) java.util.LinkedList<java.io.File>` | `auxiliaryDirectoryStack`
`(package private) java.util.LinkedList<java.lang.Runnable>` | `postRestoreTasks`

Fields 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
`ObjectPlusFilesInputStream(java.io.InputStream in, java.io.File storeDir)` Instantiate over the given stream and using the supplied auxiliary storage directory.

Method Summary
`void` | `close()` In addition to default, do any registered cleanup tasks.
`java.io.File` | `getAuxiliaryDirectory()` Return the top auxiliary directory, from which saved files are restored.
`void` | `popAuxiliaryDirectory()` Discard the top auxiliary directory.
`void` | `pushAuxiliaryDirectory(java.lang.String dir)` Push another default storage directory for use until popped.
`void` | `registerFinishTask(java.lang.Runnable task)` Register a task to be done when the ObjectPlusFilesInputStream is closed.
`void` | `restoreFile(java.io.File destination)` Restore a file from storage, using the name and length info on the serialization stream and the file from the current auxiliary directory, to the given File.
`void` | `restoreFileTo(java.io.File directory)` Restore a file from storage, using the name and length info on the serialization stream and the file from the current auxiliary directory, to the given File.

Methods inherited from class java.io.ObjectInputStream
`available, defaultReadObject, enableResolveObject, read, read, readBoolean, readByte, readChar, readClassDescriptor, readDouble, readFields, readFloat, readFully, readFully, readInt, readLine, readLong, readObject, readObjectOverride, readShort, readStreamHeader, readUnshared, readUnsignedByte, readUnsignedShort, readUTF, registerValidation, resolveClass, resolveObject, resolveProxyClass, skipBytes`

Methods inherited from class java.io.InputStream
`mark, markSupported, read, reset, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface java.io.ObjectInput
`read, skip`

Field Detail

### auxiliaryDirectoryStack

    java.util.LinkedList<java.io.File> auxiliaryDirectoryStack

### postRestoreTasks

    java.util.LinkedList<java.lang.Runnable> postRestoreTasks

Constructor Detail

### ObjectPlusFilesInputStream

    public ObjectPlusFilesInputStream(java.io.InputStream in,
                                      java.io.File storeDir)
                               throws java.io.IOException

  Instantiate over the given stream and using the supplied auxiliary storage directory.

  Parameters:
    `in` -
    `storeDir` -
  Throws:
    `java.io.IOException`

Method Detail

### pushAuxiliaryDirectory

    public void pushAuxiliaryDirectory(java.lang.String dir)

  Push another default storage directory for use until popped.

  Parameters:
    `dir` -

### popAuxiliaryDirectory

    public void popAuxiliaryDirectory()

  Discard the top auxiliary directory.

### getAuxiliaryDirectory

    public java.io.File getAuxiliaryDirectory()

  Return the top auxiliary directory, from which saved files are restored.

  Returns:
    Auxillary directory.

### restoreFile

    public void restoreFile(java.io.File destination)
                     throws java.io.IOException

  Restore a file from storage, using the name and length info on the serialization stream and the file from the current auxiliary directory, to the given File.

  Parameters:
    `destination` -
  Throws:
    `java.io.IOException`

### restoreFileTo

    public void restoreFileTo(java.io.File directory)
                       throws java.io.IOException

  Restore a file from storage, using the name and length info on the serialization stream and the file from the current auxiliary directory, to the given File.

  Parameters:
    `directory` -
  Throws:
    `java.io.IOException`

### registerFinishTask

    public void registerFinishTask(java.lang.Runnable task)

  Register a task to be done when the ObjectPlusFilesInputStream is closed.

  Parameters:
    `task` -

### close

    public void close()
               throws java.io.IOException

  In addition to default, do any registered cleanup tasks.

  Specified by:
    `close` in interface `java.io.Closeable`
  Specified by:
    `close` in interface `java.io.ObjectInput`
  Overrides:
    `close` in class `java.io.ObjectInputStream`
  Throws:
    `java.io.IOException`
  See Also:
    `InputStream.close()`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2008 Internet Archive. All Rights Reserved.