Class PostgresDataOutputStream

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

    public class PostgresDataOutputStream
    extends java.io.DataOutputStream
    A subclass of DataOutputStream 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.DataOutputStream

        written
      • Fields inherited from class java.io.FilterOutputStream

        out
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int writeLargeUTF​(java.lang.String str)
      Writes the given String to the stream in modified UTF-8 format, following its length in bytes as a four-byte integer.
      protected int writeLargeUTF​(java.util.Collection<java.lang.String> strs)
      Writes the given Collection of Strings to the stream in modified UTF-8 format, following its length in bytes as a four-byte integer.
      int writeLargeUTF​(StringConstructor str)
      Writes the given StringConstructor to the stream in modified UTF-8 format, following its length in bytes as a four-byte integer.
      • Methods inherited from class java.io.DataOutputStream

        flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
      • Methods inherited from class java.io.FilterOutputStream

        close, write
      • Methods inherited from class java.io.OutputStream

        nullOutputStream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.io.DataOutput

        write
    • Constructor Detail

      • PostgresDataOutputStream

        public PostgresDataOutputStream​(java.io.OutputStream out)
        Parameters:
        out - the OutputStream to write to
        See Also:
        DataOutputStream
    • Method Detail

      • writeLargeUTF

        public int writeLargeUTF​(java.lang.String str)
                          throws java.io.IOException
        Writes the given String to the stream in modified UTF-8 format, following its length in bytes as a four-byte integer.
        Parameters:
        str - the String
        Returns:
        the number of bytes written to the OutputStream
        Throws:
        java.io.IOException - if there is an error writing to the underlying OutputStream
      • writeLargeUTF

        public int writeLargeUTF​(StringConstructor str)
                          throws java.io.IOException
        Writes the given StringConstructor to the stream in modified UTF-8 format, following its length in bytes as a four-byte integer.
        Parameters:
        str - the StringConstructor
        Returns:
        the number of bytes written to the OutputStream
        Throws:
        java.io.IOException - if there is an error writing to the underlying OutputStream
      • writeLargeUTF

        protected int writeLargeUTF​(java.util.Collection<java.lang.String> strs)
                             throws java.io.IOException
        Writes the given Collection of Strings to the stream in modified UTF-8 format, following its length in bytes as a four-byte integer.
        Parameters:
        strs - the Collection of Strings
        Returns:
        the number of bytes written to the OutputStream
        Throws:
        java.io.IOException - if there is an error writing to the underlying OutputStream