Class FileInputStreamBuilder

  • All Implemented Interfaces:
    InputStreamBuilder, java.io.Closeable, java.lang.AutoCloseable

    public class FileInputStreamBuilder
    extends java.lang.Object
    implements InputStreamBuilder
    {code}FileInputStreamBuilder{code} is an adapter for a FileInputStream.
    • Constructor Summary

      Constructors 
      Constructor Description
      FileInputStreamBuilder​(java.io.File f)
      Creates a new InpuStreamBuilder for the given file.
      FileInputStreamBuilder​(java.io.File f, boolean deleteOnCleanup)
      Creates a new InputStreamBuilder for the given file.
      FileInputStreamBuilder​(java.lang.String s)
      Creates a new InputStreamBuilder for the given path.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Cleanup any temporary resources associated with the last returned stream.
      java.io.InputStream createInputStream()
      Return a stream in a state where no bytes have been read from it yet.
      protected void finalize()
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FileInputStreamBuilder

        public FileInputStreamBuilder​(java.io.File f)
        Creates a new InpuStreamBuilder for the given file.
        Parameters:
        f - file to wrap.
      • FileInputStreamBuilder

        public FileInputStreamBuilder​(java.io.File f,
                                      boolean deleteOnCleanup)
        Creates a new InputStreamBuilder for the given file.
        Parameters:
        f -
        deleteOnCleanup - if true, will delete file when close() is called.
      • FileInputStreamBuilder

        public FileInputStreamBuilder​(java.lang.String s)
        Creates a new InputStreamBuilder for the given path.
        Parameters:
        s - path to file
    • Method Detail

      • createInputStream

        public java.io.InputStream createInputStream()
                                              throws java.io.IOException
        Return a stream in a state where no bytes have been read from it yet. For example a newly created stream meets these criteria. The caller should handle closing the stream.
        Specified by:
        createInputStream in interface InputStreamBuilder
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Cleanup any temporary resources associated with the last returned stream.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface InputStreamBuilder
        Throws:
        java.io.IOException
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable