org.browsermob.proxy.util
Class CappedByteArrayOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.ByteArrayOutputStream
          extended by org.browsermob.proxy.util.CappedByteArrayOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class CappedByteArrayOutputStream
extends ByteArrayOutputStream

A special ByteArrayOutputStream that will only write up to X number of bytes, after which it will simply ignore the rest. This is useful for solving a JVM heap starvation issue (see MOB-216).


Field Summary
 
Fields inherited from class java.io.ByteArrayOutputStream
buf, count
 
Constructor Summary
CappedByteArrayOutputStream(int maxBytes)
           
 
Method Summary
 void write(byte[] b, int off, int len)
           
 void write(int b)
           
 
Methods inherited from class java.io.ByteArrayOutputStream
close, reset, size, toByteArray, toString, toString, toString, writeTo
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CappedByteArrayOutputStream

public CappedByteArrayOutputStream(int maxBytes)
Method Detail

write

public void write(int b)
Overrides:
write in class ByteArrayOutputStream

write

public void write(byte[] b,
                  int off,
                  int len)
Overrides:
write in class ByteArrayOutputStream


Copyright © 2011. All Rights Reserved.