Class LittleEndianDataInputStream

java.lang.Object
java.io.InputStream
org.apache.parquet.bytes.LittleEndianDataInputStream
All Implemented Interfaces:
Closeable, AutoCloseable

public final class LittleEndianDataInputStream extends InputStream
Based on DataInputStream but little endian and without the String/char methods
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a LittleEndianDataInputStream that uses the specified underlying InputStream.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    void
     
    boolean
     
    int
     
    void
    mark(int readlimit)
     
    boolean
     
    int
     
    int
    read(byte[] b)
     
    int
    read(byte[] b, int off, int len)
     
    final boolean
    See the general contract of the readBoolean method of DataInput.
    final byte
    See the general contract of the readByte method of DataInput.
    final double
    Bytes for this operation are read from the contained input stream.
    final float
    Bytes for this operation are read from the contained input stream.
    final void
    readFully(byte[] b)
    See the general contract of the readFully method of DataInput.
    final void
    readFully(byte[] b, int off, int len)
    See the general contract of the readFully method of DataInput.
    final int
    Bytes for this operation are read from the contained input stream.
    final long
    Bytes for this operation are read from the contained input stream.
    final short
    Bytes for this operation are read from the contained input stream.
    final int
    See the general contract of the readUnsignedByte method of DataInput.
    final int
    Bytes for this operation are read from the contained input stream.
    void
     
    long
    skip(long n)
     
    final int
    skipBytes(int n)
    See the general contract of the skipBytes method of DataInput.

    Methods inherited from class java.io.InputStream

    nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • LittleEndianDataInputStream

      public LittleEndianDataInputStream(InputStream in)
      Creates a LittleEndianDataInputStream that uses the specified underlying InputStream.
      Parameters:
      in - the specified input stream
  • Method Details

    • readFully

      public final void readFully(byte[] b) throws IOException
      See the general contract of the readFully method of DataInput.

      Bytes for this operation are read from the contained input stream.

      Parameters:
      b - the buffer into which the data is read.
      Throws:
      EOFException - if this input stream reaches the end before reading all the bytes.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readFully

      public final void readFully(byte[] b, int off, int len) throws IOException
      See the general contract of the readFully method of DataInput.

      Bytes for this operation are read from the contained input stream.

      Parameters:
      b - the buffer into which the data is read.
      off - the start offset of the data.
      len - the number of bytes to read.
      Throws:
      EOFException - if this input stream reaches the end before reading all the bytes.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • skipBytes

      public final int skipBytes(int n) throws IOException
      See the general contract of the skipBytes method of DataInput.

      Bytes for this operation are read from the contained input stream.

      Parameters:
      n - the number of bytes to be skipped.
      Returns:
      the actual number of bytes skipped.
      Throws:
      IOException - if the contained input stream does not support seek, or the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
    • read

      public int read() throws IOException
      Specified by:
      read in class InputStream
      Returns:
      the next byte in the stream as an int
      Throws:
      IOException - if there is an exception while reading
      See Also:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      Returns:
      the hash code of the wrapped input stream
      See Also:
    • read

      public int read(byte[] b) throws IOException
      Overrides:
      read in class InputStream
      Parameters:
      b - a byte array
      Returns:
      the number of bytes read
      Throws:
      IOException - if there was an exception while reading
      See Also:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      Parameters:
      obj - another object
      Returns:
      true if this is equal to the object
      See Also:
    • read

      public int read(byte[] b, int off, int len) throws IOException
      Overrides:
      read in class InputStream
      Parameters:
      b - a byte array
      off - an offset into the byte array
      len - the length to read
      Returns:
      the number of bytes read
      Throws:
      IOException - if there was an exception while reading
      See Also:
    • skip

      public long skip(long n) throws IOException
      Overrides:
      skip in class InputStream
      Parameters:
      n - the number of bytes to skip
      Returns:
      the number of bytes skipped
      Throws:
      IOException - if there was an exception while reading
      See Also:
    • available

      public int available() throws IOException
      Overrides:
      available in class InputStream
      Returns:
      the number of bytes available in the wrapped stream
      Throws:
      IOException - if there was an exception while getting the number of available bytes
      See Also:
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Overrides:
      close in class InputStream
      Throws:
      IOException - if there was an exception while closing the underlying stream
      See Also:
    • mark

      public void mark(int readlimit)
      Overrides:
      mark in class InputStream
      Parameters:
      readlimit - the number of bytes the mark will be valid for
      See Also:
    • reset

      public void reset() throws IOException
      Overrides:
      reset in class InputStream
      Throws:
      IOException - if there is an exception while resetting the underlying stream
      See Also:
    • markSupported

      public boolean markSupported()
      Overrides:
      markSupported in class InputStream
      Returns:
      true if mark is supported
      See Also:
    • readBoolean

      public final boolean readBoolean() throws IOException
      See the general contract of the readBoolean method of DataInput.

      Bytes for this operation are read from the contained input stream.

      Returns:
      the boolean value read.
      Throws:
      EOFException - if this input stream has reached the end.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readByte

      public final byte readByte() throws IOException
      See the general contract of the readByte method of DataInput.

      Bytes for this operation are read from the contained input stream.

      Returns:
      the next byte of this input stream as a signed 8-bit byte.
      Throws:
      EOFException - if this input stream has reached the end.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readUnsignedByte

      public final int readUnsignedByte() throws IOException
      See the general contract of the readUnsignedByte method of DataInput.

      Bytes for this operation are read from the contained input stream.

      Returns:
      the next byte of this input stream, interpreted as an unsigned 8-bit number.
      Throws:
      EOFException - if this input stream has reached the end.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readShort

      public final short readShort() throws IOException
      Bytes for this operation are read from the contained input stream.
      Returns:
      the next two bytes of this input stream, interpreted as a signed 16-bit number.
      Throws:
      EOFException - if this input stream reaches the end before reading two bytes.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readUnsignedShort

      public final int readUnsignedShort() throws IOException
      Bytes for this operation are read from the contained input stream.
      Returns:
      the next two bytes of this input stream, interpreted as an unsigned 16-bit integer.
      Throws:
      EOFException - if this input stream reaches the end before reading two bytes.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readInt

      public final int readInt() throws IOException
      Bytes for this operation are read from the contained input stream.
      Returns:
      the next four bytes of this input stream, interpreted as an int.
      Throws:
      EOFException - if this input stream reaches the end before reading four bytes.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readLong

      public final long readLong() throws IOException
      Bytes for this operation are read from the contained input stream.
      Returns:
      the next eight bytes of this input stream, interpreted as a long.
      Throws:
      EOFException - if this input stream reaches the end before reading eight bytes.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readFloat

      public final float readFloat() throws IOException
      Bytes for this operation are read from the contained input stream.
      Returns:
      the next four bytes of this input stream, interpreted as a float.
      Throws:
      EOFException - if this input stream reaches the end before reading four bytes.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also:
    • readDouble

      public final double readDouble() throws IOException
      Bytes for this operation are read from the contained input stream.
      Returns:
      the next eight bytes of this input stream, interpreted as a double.
      Throws:
      EOFException - if this input stream reaches the end before reading eight bytes.
      IOException - the stream has been closed and the contained input stream does not support reading after close, or another I/O error occurs.
      See Also: