Class LittleEndianOutput


  • @GwtCompatible
    public final class LittleEndianOutput
    extends java.lang.Object
    Simple utility for writing little endian primitives to a stream.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.OutputStream output  
    • Constructor Summary

      Constructors 
      Constructor Description
      LittleEndianOutput​(java.io.OutputStream output)
      Constructs a little-endian output that writes to the given stream.
    • Field Detail

      • output

        private final java.io.OutputStream output
    • Constructor Detail

      • LittleEndianOutput

        public LittleEndianOutput​(java.io.OutputStream output)
        Constructs a little-endian output that writes to the given stream.
    • Method Detail

      • writeByte

        public void writeByte​(byte value)
                       throws java.io.IOException
        Writes a byte.
        Throws:
        java.io.IOException
      • writeBytes

        public void writeBytes​(byte[] bytes)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeInt

        public void writeInt​(int value)
                      throws java.io.IOException
        Writes a little-endian signed integer.
        Throws:
        java.io.IOException
      • writeLong

        public void writeLong​(long value)
                       throws java.io.IOException
        Writes a little-endian signed long.
        Throws:
        java.io.IOException
      • writeFloat

        public void writeFloat​(float value)
                        throws java.io.IOException
        Writes a little-endian IEEE754 32-bit float.
        Throws:
        java.io.IOException
      • writeDouble

        public void writeDouble​(double value)
                         throws java.io.IOException
        Writes a little-endian IEEE754 64-bit double.
        Throws:
        java.io.IOException
      • writeVarint32

        public void writeVarint32​(int value)
                           throws java.io.IOException
        Writes a signed integer using variable encoding with writeVarint64(long).
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • writeVarint64

        public void writeVarint64​(long value)
                           throws java.io.IOException
        Writes a signed long using variable encoding with EncodedInts.writeVarint64(OutputStream, long).
        Throws:
        java.io.IOException - if past end of input or error in underlying stream
      • close

        public void close()
                   throws java.io.IOException
        Closes the underlying output stream.
        Throws:
        java.io.IOException