Class PostgresByteArrayOutputStream

  • All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable

    public class PostgresByteArrayOutputStream
    extends SensibleByteArrayOutputStream
    A subclass of SensibleByteArrayOutputStream that has extra methods useful for reducing the memory footprint of the Postgres database write operations.
    Author:
    Matthew Wakeling
    • Field Summary

      • Fields inherited from class java.io.ByteArrayOutputStream

        buf, count
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBuffer()
      Returns the byte buffer without copying it.
      • Methods inherited from class java.io.ByteArrayOutputStream

        close, reset, size, toByteArray, toString, toString, toString, toString, writeBytes, writeTo
      • Methods inherited from class java.io.OutputStream

        flush, nullOutputStream, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • PostgresByteArrayOutputStream

        public PostgresByteArrayOutputStream()
        see ByteArrayOutputStream
      • PostgresByteArrayOutputStream

        public PostgresByteArrayOutputStream​(int size)
        see ByteArrayOutputStream
        Parameters:
        size - the initial size of the byte array
    • Method Detail

      • getBuffer

        public byte[] getBuffer()
        Returns the byte buffer without copying it. Note that the buffer may be larger than the data written, so the contents of the buffer after the size are undefined. Also, the contents of the buffer may change if more data is written to this object.
        Returns:
        a byte array