Class EndianDataInputStream


  • public class EndianDataInputStream
    extends java.lang.Object
    A class that gives most of the functionality of DataInputStream, but is endian aware. Uses a real java.io.DataInputStream to actually do the writing.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.DataInputStream inputStream  
      private byte[] workSpace  
    • Constructor Summary

      Constructors 
      Constructor Description
      EndianDataInputStream​(java.io.InputStream in)
      Creates new EndianDataInputStream
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      close the stream
      byte readByteBE()
      read a byte in BigEndian - the same as LE because its only 1 byte
      byte readByteLE()
      read a byte in LittleEndian - the same as BE because its only 1 byte
      void readByteLEnum​(byte[] b)
      read a byte in LittleEndian - the same as BE because its only 1 byte
      double readDoubleBE()
      read a 64bit double in BE
      double readDoubleLE()
      read a 64bit double in LE
      int readIntBE()
      read a 32bit int in BE
      int readIntLE()
      read a 32bit int in LE
      long readLongBE()
      read a 64bit long in BE
      long readLongLE()
      read a 64bit long in LE
      short readShortBE()
      read a 16bit short in BE
      short readShortLE()
      read a 16bit short in LE
      int readUnsignedByteBE()
      read a byte in BigEndian - the same as LE because its only 1 byte.
      int readUnsignedByteLE()
      read a byte in LittleEndian - the same as BE because its only 1 byte.
      int skipBytes​(int num)
      skip ahead in the stream
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • inputStream

        private java.io.DataInputStream inputStream
      • workSpace

        private byte[] workSpace
    • Constructor Detail

      • EndianDataInputStream

        public EndianDataInputStream​(java.io.InputStream in)
        Creates new EndianDataInputStream
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        close the stream
        Throws:
        java.io.IOException
      • readByteBE

        public byte readByteBE()
                        throws java.io.IOException
        read a byte in BigEndian - the same as LE because its only 1 byte
        Throws:
        java.io.IOException
      • readByteLE

        public byte readByteLE()
                        throws java.io.IOException
        read a byte in LittleEndian - the same as BE because its only 1 byte
        Throws:
        java.io.IOException
      • readByteLEnum

        public void readByteLEnum​(byte[] b)
                           throws java.io.IOException
        read a byte in LittleEndian - the same as BE because its only 1 byte
        Throws:
        java.io.IOException
      • readUnsignedByteBE

        public int readUnsignedByteBE()
                               throws java.io.IOException
        read a byte in BigEndian - the same as LE because its only 1 byte. returns int as per java.io.DataStream
        Throws:
        java.io.IOException
      • readUnsignedByteLE

        public int readUnsignedByteLE()
                               throws java.io.IOException
        read a byte in LittleEndian - the same as BE because its only 1 byte. returns int as per java.io.DataStream
        Throws:
        java.io.IOException
      • readShortBE

        public short readShortBE()
                          throws java.io.IOException
        read a 16bit short in BE
        Throws:
        java.io.IOException
      • readShortLE

        public short readShortLE()
                          throws java.io.IOException
        read a 16bit short in LE
        Throws:
        java.io.IOException
      • readIntBE

        public int readIntBE()
                      throws java.io.IOException
        read a 32bit int in BE
        Throws:
        java.io.IOException
      • readIntLE

        public int readIntLE()
                      throws java.io.IOException
        read a 32bit int in LE
        Throws:
        java.io.IOException
      • readLongBE

        public long readLongBE()
                        throws java.io.IOException
        read a 64bit long in BE
        Throws:
        java.io.IOException
      • readLongLE

        public long readLongLE()
                        throws java.io.IOException
        read a 64bit long in LE
        Throws:
        java.io.IOException
      • readDoubleBE

        public double readDoubleBE()
                            throws java.io.IOException
        read a 64bit double in BE
        Throws:
        java.io.IOException
      • readDoubleLE

        public double readDoubleLE()
                            throws java.io.IOException
        read a 64bit double in LE
        Throws:
        java.io.IOException
      • skipBytes

        public int skipBytes​(int num)
                      throws java.io.IOException
        skip ahead in the stream
        Parameters:
        num - number of bytes to read ahead
        Throws:
        java.io.IOException