Class ReadOnceTempFileByteBuffer

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

    public class ReadOnceTempFileByteBuffer
    extends TempFileByteBuffer
    This sub-class of TempFileByteBuffer is only capable to return one InputStream. When this call is invoked the responsibility to delete a possible temporary file is given to the input stream which in turn will delete said file when closed.
    Author:
    jschwarz
    • Constructor Detail

      • ReadOnceTempFileByteBuffer

        public ReadOnceTempFileByteBuffer​(int inMemoryBytes)
        Parameters:
        inMemoryBytes - number of bytes to keep in memory before using a temp file
      • ReadOnceTempFileByteBuffer

        public ReadOnceTempFileByteBuffer​(int inMemoryBytes,
                                          java.io.File tempFileDirectory)
        Parameters:
        inMemoryBytes - number of bytes to keep in memory before using a temp file
        tempFileDirectory - directory to store temporary files in
    • Method Detail

      • getInputStream

        public java.io.InputStream getInputStream()
                                           throws java.io.IOException
        Overrides:
        getInputStream in class TempFileByteBuffer
        Returns:
        an input stream to read the bytes stored in this buffer
        Throws:
        java.io.IOException - IO exception when opering the stream
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class TempFileByteBuffer
        Throws:
        java.io.IOException