Package org.apache.parquet.bytes
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 LittleEndianDataInputStream(InputStream in)
Creates a LittleEndianDataInputStream that uses the specified underlying InputStream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
boolean
equals(Object obj)
int
hashCode()
void
mark(int readlimit)
boolean
markSupported()
int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
boolean
readBoolean()
See the general contract of thereadBoolean
method ofDataInput
.byte
readByte()
See the general contract of thereadByte
method ofDataInput
.double
readDouble()
Bytes for this operation are read from the contained input stream.float
readFloat()
Bytes for this operation are read from the contained input stream.void
readFully(byte[] b)
See the general contract of thereadFully
method ofDataInput
.void
readFully(byte[] b, int off, int len)
See the general contract of thereadFully
method ofDataInput
.int
readInt()
Bytes for this operation are read from the contained input stream.long
readLong()
Bytes for this operation are read from the contained input stream.short
readShort()
Bytes for this operation are read from the contained input stream.int
readUnsignedByte()
See the general contract of thereadUnsignedByte
method ofDataInput
.int
readUnsignedShort()
Bytes for this operation are read from the contained input stream.void
reset()
long
skip(long n)
int
skipBytes(int n)
See the general contract of theskipBytes
method ofDataInput
.-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
LittleEndianDataInputStream
public LittleEndianDataInputStream(InputStream in)
Creates a LittleEndianDataInputStream that uses the specified underlying InputStream.- Parameters:
in
- the specified input stream
-
-
Method Detail
-
readFully
public final void readFully(byte[] b) throws IOException
See the general contract of thereadFully
method ofDataInput
.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:
FilterInputStream.in
-
readFully
public final void readFully(byte[] b, int off, int len) throws IOException
See the general contract of thereadFully
method ofDataInput
.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:
FilterInputStream.in
-
skipBytes
public final int skipBytes(int n) throws IOException
See the general contract of theskipBytes
method ofDataInput
.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 classInputStream
- Returns:
- the next byte in the stream as an int
- Throws:
IOException
- if there is an exception while reading- See Also:
InputStream.read()
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classObject
- Returns:
- the hash code of the wrapped input stream
- See Also:
Object.hashCode()
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classInputStream
- Parameters:
b
- a byte array- Returns:
- the number of bytes read
- Throws:
IOException
- if there was an exception while reading- See Also:
InputStream.read(byte[])
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classObject
- Parameters:
obj
- another object- Returns:
- true if this is equal to the object
- See Also:
Object.equals(java.lang.Object)
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Parameters:
b
- a byte arrayoff
- an offset into the byte arraylen
- the length to read- Returns:
- the number of bytes read
- Throws:
IOException
- if there was an exception while reading- See Also:
InputStream.read(byte[], int, int)
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classInputStream
- 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:
InputStream.skip(long)
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- 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:
InputStream.available()
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
- if there was an exception while closing the underlying stream- See Also:
InputStream.close()
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classInputStream
- Parameters:
readlimit
- the number of bytes the mark will be valid for- See Also:
InputStream.mark(int)
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
- if there is an exception while resetting the underlying stream- See Also:
InputStream.reset()
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
- Returns:
- true if mark is supported
- See Also:
InputStream.markSupported()
-
readBoolean
public final boolean readBoolean() throws IOException
See the general contract of thereadBoolean
method ofDataInput
.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:
FilterInputStream.in
-
readByte
public final byte readByte() throws IOException
See the general contract of thereadByte
method ofDataInput
.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:
FilterInputStream.in
-
readUnsignedByte
public final int readUnsignedByte() throws IOException
See the general contract of thereadUnsignedByte
method ofDataInput
.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:
FilterInputStream.in
-
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:
FilterInputStream.in
-
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:
FilterInputStream.in
-
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:
FilterInputStream.in
-
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:
FilterInputStream.in
-
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:
Float.intBitsToFloat(int)
-
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:
Double.longBitsToDouble(long)
-
-