Class BinFileOutput<T>

  • All Implemented Interfaces:
    FileOutput<T>, Output<T>, java.io.Closeable, java.lang.AutoCloseable

    public class BinFileOutput<T>
    extends BinOutput<T>
    implements FileOutput<T>

    An item input implementation serializing something to the specified file.

    WARNING: doesn't support the appending of the previously used output file (already containing the data which had been output earlier). This limitation is due to Java serialization, which adds the new header on each new ObjectOutputStream instance.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.nio.file.Path dstPath  
    • Constructor Summary

      Constructors 
      Constructor Description
      BinFileOutput()
      Opens the temporary output file with ".bin" extension and random name.
      BinFileOutput​(java.nio.file.Path dstPath)  
    • Field Detail

      • dstPath

        protected final java.nio.file.Path dstPath
    • Constructor Detail

      • BinFileOutput

        public BinFileOutput​(java.nio.file.Path dstPath)
                      throws java.io.IOException
        Parameters:
        dstPath - the path to the file which should be used to store the serialized items
        Throws:
        java.io.IOException - if unable to open the file for writing
      • BinFileOutput

        public BinFileOutput()
                      throws java.io.IOException
        Opens the temporary output file with ".bin" extension and random name.
        Throws:
        java.io.IOException
    • Method Detail

      • getInput

        public BinFileInput<T> getInput()
                                 throws java.io.IOException
        Description copied from interface: Output
        Make a Input instance from this.
        Specified by:
        getInput in interface Output<T>
        Returns:
        Input instance containing the items which had been written to this output.
        Throws:
        java.io.IOException
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class BinOutput<T>
      • getFilePath

        public final java.nio.file.Path getFilePath()
        Specified by:
        getFilePath in interface FileOutput<T>