Package org.apache.orc.impl
Class OutStream
java.lang.Object
java.io.OutputStream
org.apache.orc.impl.PositionedOutputStream
org.apache.orc.impl.OutStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
The output stream for writing to ORC files.
It handles both compression and encryption.
-
Field Summary
Modifier and TypeFieldDescriptionLazily initialized: Won't allocate byte buffer until invocation of init()static final int
-
Constructor Summary
ConstructorDescriptionOutStream
(Object name, StreamOptions options, PhysicalWriter.OutputReceiver receiver) -
Method Summary
Modifier and TypeMethodDescriptionstatic void
assertBufferSizeValid
(int bufferSize) Throws exception if the bufferSize argument equals or exceeds 2^(3*8 - 1).void
Change the current Initialization Vector (IV) for the encryption.void
flush()
long
Get the memory size currently allocated as buffer associated with this stream.void
getPosition
(PositionRecorder recorder) Record the current position to the recorder.void
suppress()
Set suppress flagtoString()
void
write
(byte[] bytes, int offset, int length) void
write
(int i) Methods inherited from class java.io.OutputStream
close, nullOutputStream, write
-
Field Details
-
HEADER_SIZE
public static final int HEADER_SIZE- See Also:
-
compressedBuffer
Lazily initialized: Won't allocate byte buffer until invocation of init()
-
-
Constructor Details
-
OutStream
-
-
Method Details
-
changeIv
Change the current Initialization Vector (IV) for the encryption.- Specified by:
changeIv
in classPositionedOutputStream
- Parameters:
modifier
- a function to modify the IV in place
-
assertBufferSizeValid
Throws exception if the bufferSize argument equals or exceeds 2^(3*8 - 1). SeewriteHeader(ByteBuffer, int, int, boolean)
. The bufferSize needs to be expressible in 3 bytes, and uses the least significant byte to indicate original/compressed bytes.- Parameters:
bufferSize
- The ORC compression buffer size being checked.- Throws:
IllegalArgumentException
- If bufferSize value exceeds threshold.
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in classOutputStream
- Throws:
IOException
-
getPosition
Description copied from class:PositionedOutputStream
Record the current position to the recorder.- Specified by:
getPosition
in classPositionedOutputStream
- Parameters:
recorder
- the object that receives the position
-
flush
- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
toString
-
getBufferSize
public long getBufferSize()Description copied from class:PositionedOutputStream
Get the memory size currently allocated as buffer associated with this stream.- Specified by:
getBufferSize
in classPositionedOutputStream
- Returns:
- the number of bytes used by buffers.
-
suppress
public void suppress()Set suppress flag
-