org.apache.commons.compress.compressors.zstandard

## Class ZstdCompressorOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.commons.compress.compressors.CompressorOutputStream
    - - org.apache.commons.compress.compressors.zstandard.ZstdCompressorOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class ZstdCompressorOutputStream
      extends CompressorOutputStream

  `CompressorOutputStream` implementation to create Zstandard encoded stream. Library relies on Zstandard JNI
  Since:
    1.16

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ZstdCompressorOutputStream(OutputStream outStream)` Wraps the given stream into a zstd-jni ZstdOutputStream using the default values for `level`, `closeFrameOnFlush` and `useChecksum`.
    `ZstdCompressorOutputStream(OutputStream outStream, int level)` Wraps the given stream into a zstd-jni ZstdOutputStream using the default values for `closeFrameOnFlush` and `useChecksum`.
    `ZstdCompressorOutputStream(OutputStream outStream, int level, boolean closeFrameOnFlush)` Wraps the given stream into a zstd-jni ZstdOutputStream using the default value for `useChecksum`.
    `ZstdCompressorOutputStream(OutputStream outStream, int level, boolean closeFrameOnFlush, boolean useChecksum)` Wraps the given stream into a zstd-jni ZstdOutputStream.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `void` | `flush()`
    `String` | `toString()`
    `void` | `write(byte[] buf, int off, int len)`
    `void` | `write(int b)`

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

      `write`

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

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

- - ### Constructor Detail

    - #### ZstdCompressorOutputStream

          public ZstdCompressorOutputStream(OutputStream outStream)
                                     throws IOException

      Wraps the given stream into a zstd-jni ZstdOutputStream using the default values for `level`, `closeFrameOnFlush` and `useChecksum`.
      Parameters:
        `outStream` - the stream to write to
      Throws:
        `IOException` - if zstd-jni does

    - #### ZstdCompressorOutputStream

          public ZstdCompressorOutputStream(OutputStream outStream,
                                            int level)
                                     throws IOException

      Wraps the given stream into a zstd-jni ZstdOutputStream using the default values for `closeFrameOnFlush` and `useChecksum`.
      Parameters:
        `outStream` - the stream to write to
        `level` - value for zstd-jni's level argument
      Throws:
        `IOException` - if zstd-jni does
      Since:
        1.18

    - #### ZstdCompressorOutputStream

          public ZstdCompressorOutputStream(OutputStream outStream,
                                            int level,
                                            boolean closeFrameOnFlush)
                                     throws IOException

      Wraps the given stream into a zstd-jni ZstdOutputStream using the default value for `useChecksum`.
      Parameters:
        `outStream` - the stream to write to
        `level` - value for zstd-jni's level argument
        `closeFrameOnFlush` - value for zstd-jni's closeFrameOnFlush argument
      Throws:
        `IOException` - if zstd-jni does
      Since:
        1.18

    - #### ZstdCompressorOutputStream

          public ZstdCompressorOutputStream(OutputStream outStream,
                                            int level,
                                            boolean closeFrameOnFlush,
                                            boolean useChecksum)
                                     throws IOException

      Wraps the given stream into a zstd-jni ZstdOutputStream.
      Parameters:
        `outStream` - the stream to write to
        `level` - value for zstd-jni's level argument
        `closeFrameOnFlush` - value for zstd-jni's closeFrameOnFlush argument
        `useChecksum` - value for zstd-jni's useChecksum argument
      Throws:
        `IOException` - if zstd-jni does
      Since:
        1.18

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `OutputStream`
      Throws:
        `IOException`

    - #### 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`

    - #### write

          public void write(byte[] buf,
                            int off,
                            int len)
                     throws IOException

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

    - #### write

          public void write(int b)
                     throws IOException

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

Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.