Package org.apache.parquet.bytes
Class LittleEndianDataOutputStream
java.lang.Object
java.io.OutputStream
org.apache.parquet.bytes.LittleEndianDataOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Based on DataOutputStream but in little endian and without the String/char methods
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new data output stream to write data to the specified underlying output stream. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.final voidwriteBoolean(boolean v) Writes abooleanto the underlying output stream as a 1-byte value.final voidwriteByte(int v) Writes out abyteto the underlying output stream as a 1-byte value.final voidwriteDouble(double v) Converts the double argument to alongusing thedoubleToRawLongBitsmethod in classDouble, and then writes thatlongvalue to the underlying output stream as an 8-byte quantity, low byte first.final 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.final voidwriteInt(int v) Writes anintto the underlying output stream as four bytes, low byte first.final voidwriteLong(long v) Writes alongto the underlying output stream as eight bytes, low byte first.final 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 Details
-
LittleEndianDataOutputStream
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:
-
-
Method Details
-
write
Writes 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:
-
write
Writeslenbytes 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:
-
flush
Flushes 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:
-
writeBoolean
Writes 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:
-
writeByte
Writes 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:
-
writeShort
Writes 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:
-
writeInt
Writes 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:
-
writeLong
Writes 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:
-
writeFloat
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. 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:
-
writeDouble
Converts the double argument to alongusing thedoubleToRawLongBitsmethod 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:
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream
-