Package org.apache.parquet.bytes
Class LittleEndianDataOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.parquet.bytes.LittleEndianDataOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
public class LittleEndianDataOutputStream extends OutputStream
Based on DataOutputStream but in little endian and without the String/char methods
-
-
Constructor Summary
Constructors Constructor Description LittleEndianDataOutputStream(OutputStream out)Creates a new data output stream to write data to the specified underlying output stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()voidflush()Flushes this data output stream.voidwrite(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto the underlying output stream.voidwrite(int b)Writes the specified byte (the low eight bits of the argumentb) to the underlying output stream.voidwriteBoolean(boolean v)Writes abooleanto the underlying output stream as a 1-byte value.voidwriteByte(int v)Writes out abyteto the underlying output stream as a 1-byte value.voidwriteDouble(double v)Converts the double argument to alongusing thedoubleToLongBitsmethod in classDouble, and then writes thatlongvalue to the underlying output stream as an 8-byte quantity, low byte first.voidwriteFloat(float v)Converts the float argument to anintusing thefloatToIntBitsmethod in classFloat, and then writes thatintvalue to the underlying output stream as a 4-byte quantity, low byte first.voidwriteInt(int v)Writes anintto the underlying output stream as four bytes, low byte first.voidwriteLong(long v)Writes alongto the underlying output stream as eight bytes, low byte first.voidwriteShort(int v)Writes ashortto the underlying output stream as two bytes, low byte first.-
Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
-
-
-
Constructor Detail
-
LittleEndianDataOutputStream
public LittleEndianDataOutputStream(OutputStream out)
Creates a new data output stream to write data to the specified underlying output stream. The counterwrittenis set to zero.- Parameters:
out- the underlying output stream, to be saved for later use.- See Also:
FilterOutputStream.out
-
-
Method Detail
-
write
public void write(int b) throws IOExceptionWrites the specified byte (the low eight bits of the argumentb) to the underlying output stream. If no exception is thrown, the counterwrittenis incremented by1.Implements the
writemethod ofOutputStream.- Specified by:
writein classOutputStream- Parameters:
b- thebyteto be written.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out
-
write
public void write(byte[] b, int off, int len) throws IOExceptionWriteslenbytes from the specified byte array starting at offsetoffto the underlying output stream. If no exception is thrown, the counterwrittenis incremented bylen.- Overrides:
writein classOutputStream- Parameters:
b- the data.off- the start offset in the data.len- the number of bytes to write.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out
-
flush
public void flush() throws IOExceptionFlushes this data output stream. This forces any buffered output bytes to be written out to the stream.The
flushmethod ofDataOutputStreamcalls theflushmethod of its underlying output stream.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out,OutputStream.flush()
-
writeBoolean
public final void writeBoolean(boolean v) throws IOExceptionWrites abooleanto the underlying output stream as a 1-byte value. The valuetrueis written out as the value(byte)1; the valuefalseis written out as the value(byte)0. If no exception is thrown, the counterwrittenis incremented by1.- Parameters:
v- abooleanvalue to be written.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out
-
writeByte
public final void writeByte(int v) throws IOExceptionWrites out abyteto the underlying output stream as a 1-byte value. If no exception is thrown, the counterwrittenis incremented by1.- Parameters:
v- abytevalue to be written.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out
-
writeShort
public final void writeShort(int v) throws IOExceptionWrites ashortto the underlying output stream as two bytes, low byte first. If no exception is thrown, the counterwrittenis incremented by2.- Parameters:
v- ashortto be written.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out
-
writeInt
public final void writeInt(int v) throws IOExceptionWrites anintto the underlying output stream as four bytes, low byte first. If no exception is thrown, the counterwrittenis incremented by4.- Parameters:
v- anintto be written.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out
-
writeLong
public final void writeLong(long v) throws IOExceptionWrites alongto the underlying output stream as eight bytes, low byte first. In no exception is thrown, the counterwrittenis incremented by8.- Parameters:
v- alongto be written.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out
-
writeFloat
public final void writeFloat(float v) throws IOExceptionConverts the float argument to anintusing thefloatToIntBitsmethod in classFloat, and then writes thatintvalue to the underlying output stream as a 4-byte quantity, low byte first. If no exception is thrown, the counterwrittenis incremented by4.- Parameters:
v- afloatvalue to be written.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out,Float.floatToIntBits(float)
-
writeDouble
public final void writeDouble(double v) throws IOExceptionConverts the double argument to alongusing thedoubleToLongBitsmethod in classDouble, and then writes thatlongvalue to the underlying output stream as an 8-byte quantity, low byte first. If no exception is thrown, the counterwrittenis incremented by8.- Parameters:
v- adoublevalue to be written.- Throws:
IOException- if an I/O error occurs.- See Also:
FilterOutputStream.out,Double.doubleToLongBits(double)
-
close
public void close()
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-
-