Class BinFileOutput<T>

  • All Implemented Interfaces:
    FileIo, FileOutput<T>, Output<T>, java.lang.AutoCloseable, java.util.function.Consumer<T>

    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.

    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.nio.file.Path filePath()  
      BinFileInput<T> getInput()
      Make a Input instance from this.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.lang.AutoCloseable

        close
      • Methods inherited from interface java.util.function.Consumer

        andThen
    • Field Detail

      • dstPath

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

      • BinFileOutput

        public BinFileOutput​(java.nio.file.Path dstPath)
        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()
        Opens the temporary output file with ".bin" extension and random name.
    • Method Detail

      • getInput

        public BinFileInput<T> getInput()
        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.
      • toString

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

        public final java.nio.file.Path filePath()
        Specified by:
        filePath in interface FileIo