Class MessageBufferOutputStream

java.lang.Object
java.io.OutputStream
com.mimecast.robin.storage.MessageBufferOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class MessageBufferOutputStream extends OutputStream
Buffers message receipt in memory and spills to disk after a configured threshold.
  • Field Details

    • thresholdBytes

      private final long thresholdBytes
    • spillFile

      private final Path spillFile
    • memoryStream

      private ByteArrayOutputStream memoryStream
    • activeStream

      private OutputStream activeStream
    • size

      private long size
    • closed

      private boolean closed
  • Constructor Details

    • MessageBufferOutputStream

      public MessageBufferOutputStream(long thresholdBytes, Path spillFile)
      Constructs a new buffered output stream.
      Parameters:
      thresholdBytes - Spill threshold.
      spillFile - Spill target file.
  • Method Details