Class MaxSizeProtectedOutputStream

java.lang.Object
java.io.OutputStream
java.io.ByteArrayOutputStream
no.difi.asic.zipbomb.MaxSizeProtectedOutputStream
All Implemented Interfaces:
Closeable, Flushable, AutoCloseable

public class MaxSizeProtectedOutputStream extends ByteArrayOutputStream
Use this as a simplified replacement for ByteArrayOutputStream. It will abort writing to the output stream by throwing RuntimeException when configured size has been exceeded.
  • Constructor Details

    • MaxSizeProtectedOutputStream

      public MaxSizeProtectedOutputStream()
      Default limit is set to 1 MiB
    • MaxSizeProtectedOutputStream

      public MaxSizeProtectedOutputStream(long maxSize)
      Set any limit you want as long as it's more than 1024 bytes
  • Method Details