Class LimitedByteArrayOutputStream

java.lang.Object
java.io.OutputStream
com.google.gerrit.server.ioutil.LimitedByteArrayOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class LimitedByteArrayOutputStream extends OutputStream
A stream that throws an exception if it consumes data beyond a configured byte count.
  • Constructor Details

    • LimitedByteArrayOutputStream

      public LimitedByteArrayOutputStream(int max, int initial)
      Constructs a LimitedByteArrayOutputStream, which stores output in memory up to a certain specified size. When the output exceeds the specified size a LimitExceededException is thrown.
      Parameters:
      max - the maximum size in bytes which may be stored.
      initial - the initial size. It must be smaller than the max size.
  • Method Details