Class CompactDataOutput

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

    public class CompactDataOutput
    extends java.io.DataOutputStream
    Additional data output methods for compact storage of data structures.
    See Also:
    CompactDataInput
    • Field Summary

      • Fields inherited from class java.io.DataOutputStream

        written
      • Fields inherited from class java.io.FilterOutputStream

        out
    • Constructor Summary

      Constructors 
      Constructor Description
      CompactDataOutput​(java.io.OutputStream out)
      Creates a new CompactDataOutput instance that writes data to the specified underlying output stream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void writeBooleanArray​(boolean[] value)
      Writes a boolean array.
      void writeVarInt​(int value)
      Writes a variable length representation of an integer value that reduces the number of written bytes for small positive values.
      • 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

      • CompactDataOutput

        public CompactDataOutput​(java.io.OutputStream out)
        Creates a new CompactDataOutput instance that writes data to the specified underlying output stream
        Parameters:
        out - underlying output stream
    • Method Detail

      • writeVarInt

        public void writeVarInt​(int value)
                         throws java.io.IOException
        Writes a variable length representation of an integer value that reduces the number of written bytes for small positive values. Depending on the given value 1 to 5 bytes will be written to the underlying stream.
        Parameters:
        value - value to write
        Throws:
        java.io.IOException - if thrown by the underlying stream
      • writeBooleanArray

        public void writeBooleanArray​(boolean[] value)
                               throws java.io.IOException
        Writes a boolean array. Internally a sequence of boolean values is packed into single bits.
        Parameters:
        value - boolean array
        Throws:
        java.io.IOException - if thrown by the underlying stream