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 intavailable()voidclose()booleanequals(Object obj)inthashCode()voidmark(int readlimit)booleanmarkSupported()intread()intread(byte[] b)intread(byte[] b, int off, int len)booleanreadBoolean()See the general contract of thereadBooleanmethod ofDataInput.bytereadByte()See the general contract of thereadBytemethod ofDataInput.doublereadDouble()Bytes for this operation are read from the contained input stream.floatreadFloat()Bytes for this operation are read from the contained input stream.voidreadFully(byte[] b)See the general contract of thereadFullymethod ofDataInput.voidreadFully(byte[] b, int off, int len)See the general contract of thereadFullymethod ofDataInput.intreadInt()Bytes for this operation are read from the contained input stream.longreadLong()Bytes for this operation are read from the contained input stream.shortreadShort()Bytes for this operation are read from the contained input stream.intreadUnsignedByte()See the general contract of thereadUnsignedBytemethod ofDataInput.intreadUnsignedShort()Bytes for this operation are read from the contained input stream.voidreset()longskip(long n)intskipBytes(int n)See the general contract of theskipBytesmethod 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 IOExceptionSee the general contract of thereadFullymethod 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 IOExceptionSee the general contract of thereadFullymethod 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 IOExceptionSee the general contract of theskipBytesmethod 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:
readin 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:
hashCodein classObject- Returns:
- the hash code of the wrapped input stream
- See Also:
Object.hashCode()
-
read
public int read(byte[] b) throws IOException- Overrides:
readin 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:
equalsin 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:
readin 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:
skipin 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:
availablein 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:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException- if there was an exception while closing the underlying stream- See Also:
InputStream.close()
-
mark
public void mark(int readlimit)
- Overrides:
markin 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:
resetin classInputStream- Throws:
IOException- if there is an exception while resetting the underlying stream- See Also:
InputStream.reset()
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream- Returns:
- true if mark is supported
- See Also:
InputStream.markSupported()
-
readBoolean
public final boolean readBoolean() throws IOExceptionSee the general contract of thereadBooleanmethod ofDataInput.Bytes for this operation are read from the contained input stream.
- Returns:
- the
booleanvalue 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 IOExceptionSee the general contract of thereadBytemethod 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 IOExceptionSee the general contract of thereadUnsignedBytemethod 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 IOExceptionBytes 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 IOExceptionBytes 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 IOExceptionBytes 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 IOExceptionBytes 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 IOExceptionBytes 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 IOExceptionBytes 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)
-
-