OutStream (ORC Core 1.6.6 API)
Date: 2021-01-13

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

      public class OutStream
      extends PositionedOutputStream

  The output stream for writing to ORC files. It handles both compression and encryption.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `HEADER_SIZE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OutStream(Object name, StreamOptions options, PhysicalWriter.OutputReceiver receiver)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static void` | `assertBufferSizeValid(int bufferSize)` Throws exception if the bufferSize argument equals or exceeds 2^(3*8 - 1).
    `void` | `changeIv(Consumer<byte[]> modifier)` Change the current Initialization Vector (IV) for the encryption.
    `void` | `flush()`
    `long` | `getBufferSize()` 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 flag
    `String` | `toString()`
    `void` | `write(byte[] bytes, int offset, int length)`
    `void` | `write(int i)`

    - ### Methods inherited from class java.io.OutputStream

      `close, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### HEADER_SIZE

          public static final int HEADER_SIZE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### OutStream

          public OutStream(Object name,
                           StreamOptions options,
                           PhysicalWriter.OutputReceiver receiver)

  - ### Method Detail

    - #### changeIv

          public void changeIv(Consumer<byte[]> modifier)

      Change the current Initialization Vector (IV) for the encryption.
      Specified by:
        `changeIv` in class `PositionedOutputStream`
      Parameters:
        `modifier` - a function to modify the IV in place

    - #### assertBufferSizeValid

          public static void assertBufferSizeValid(int bufferSize)
                                            throws IllegalArgumentException

      Throws exception if the bufferSize argument equals or exceeds 2^(3*8 - 1). See `writeHeader(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

          public void write(int i)
                     throws IOException

      Specified by:
        `write` in class `OutputStream`
      Throws:
        `IOException`

    - #### write

          public void write(byte[] bytes,
                            int offset,
                            int length)
                     throws IOException

      Overrides:
        `write` in class `OutputStream`
      Throws:
        `IOException`

    - #### getPosition

          public void getPosition(PositionRecorder recorder)

      Description copied from class: `PositionedOutputStream`
      Record the current position to the recorder.
      Specified by:
        `getPosition` in class `PositionedOutputStream`
      Parameters:
        `recorder` - the object that receives the position

    - #### flush

          public void flush()
                     throws IOException

      Specified by:
        `flush` in interface `Flushable`
      Overrides:
        `flush` in class `OutputStream`
      Throws:
        `IOException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### 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 class `PositionedOutputStream`
      Returns:
        the number of bytes used by buffers.

    - #### suppress

          public void suppress()

      Set suppress flag

Copyright © 2013–2021 The Apache Software Foundation. All rights reserved.