Class TemporaryBuffer.LocalFile

  • All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable
    Enclosing class:
    TemporaryBuffer

    public static class TemporaryBuffer.LocalFile
    extends TemporaryBuffer
    A fully buffered output stream using local disk storage for large data.

    Initially this output stream buffers to memory and is therefore similar to ByteArrayOutputStream, but it shifts to using an on disk temporary file if the output gets too large.

    The content of this buffered stream may be sent to another OutputStream only after this stream has been properly closed by TemporaryBuffer.close().

    • Constructor Detail

      • LocalFile

        public LocalFile​(File directory)
        Create a new temporary buffer, limiting memory usage.
        Parameters:
        directory - if the buffer has to spill over into a temporary file, the directory where the file should be saved. If null the system default temporary directory (for example /tmp) will be used instead.
      • LocalFile

        public LocalFile​(File directory,
                         int inCoreLimit)
        Create a new temporary buffer, limiting memory usage.
        Parameters:
        directory - if the buffer has to spill over into a temporary file, the directory where the file should be saved. If null the system default temporary directory (for example /tmp) will be used instead.
        inCoreLimit - maximum number of bytes to store in memory. Storage beyond this limit will use the local file.