Class FileBackedOutputStream

java.lang.Object
java.io.OutputStream
org.opendaylight.controller.cluster.io.FileBackedOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable
Direct Known Subclasses:
SharedFileBackedOutputStream

public class FileBackedOutputStream extends OutputStream
An OutputStream that starts buffering to a byte array, but switches to file buffering once the data reaches a configurable size. This class is thread-safe.
Author:
Thomas Pantelis
  • Constructor Details

    • FileBackedOutputStream

      public FileBackedOutputStream(int fileThreshold, @Nullable String fileDirectory)
      Creates a new instance that uses the given file threshold, and does not reset the data when the ByteSource returned by asByteSource() is finalized.
      Parameters:
      fileThreshold - the number of bytes before the stream should switch to buffering to a file
      fileDirectory - the directory in which to create the file if needed. If null, the default temp file location is used.
  • Method Details