Enum Class Compression

java.lang.Object
java.lang.Enum<Compression>
org.apache.beam.sdk.io.Compression
All Implemented Interfaces:
Serializable, Comparable<Compression>, Constable

public enum Compression extends Enum<Compression>
Various compression types for reading/writing files.
  • Enum Constant Details

    • AUTO

      public static final Compression AUTO
      When reading a file, automatically determine the compression type based on filename extension. Not applicable when writing files.
    • UNCOMPRESSED

      public static final Compression UNCOMPRESSED
      No compression.
    • GZIP

      public static final Compression GZIP
      GZip compression.
    • BZIP2

      public static final Compression BZIP2
      BZip compression.
    • ZIP

      public static final Compression ZIP
      Zip compression.
    • ZSTD

      public static final Compression ZSTD
      ZStandard compression.

      The .zst extension is specified in RFC 8478.

      The Beam Java SDK does not pull in the Zstd library by default, so it is the user's responsibility to declare an explicit dependency on zstd-jni. Attempts to read or write .zst files without zstd-jni loaded will result in NoClassDefFoundError at runtime.

    • LZO

      public static final Compression LZO
      LZO compression using LZO codec. .lzo_deflate extension is specified for files which use the LZO algorithm without headers.

      The Beam Java SDK does not pull in the required libraries for LZO compression by default, so it is the user's responsibility to declare an explicit dependency on io.airlift:aircompressor and com.facebook.presto.hadoop:hadoop-apache2. Attempts to read or write .lzo_deflate files without io.airlift:aircompressor and com.facebook.presto.hadoop:hadoop-apache2 loaded will result in a NoClassDefFoundError at runtime.

    • LZOP

      public static final Compression LZOP
      LZOP compression using LZOP codec. .lzo extension is specified for files with magic bytes and headers.

      Warning: The LZOP codec being used does not support concatenated LZOP streams and will silently ignore data after the end of the first LZOP stream.

      The Beam Java SDK does not pull in the required libraries for LZOP compression by default, so it is the user's responsibility to declare an explicit dependency on io.airlift:aircompressor and com.facebook.presto.hadoop:hadoop-apache2. Attempts to read or write .lzo files without io.airlift:aircompressor and com.facebook.presto.hadoop:hadoop-apache2 loaded will result in a NoClassDefFoundError at runtime.

    • DEFLATE

      public static final Compression DEFLATE
      Deflate compression.
    • SNAPPY

      public static final Compression SNAPPY
      Google Snappy compression.
  • Method Details

    • values

      public static Compression[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Compression valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • getSuggestedSuffix

      public String getSuggestedSuffix()
    • matches

      public boolean matches(String filename)
    • isCompressed

      public boolean isCompressed(String filename)
    • detect

      public static Compression detect(String filename)
    • readDecompressed

      public abstract ReadableByteChannel readDecompressed(ReadableByteChannel channel) throws IOException
      Throws:
      IOException
    • writeCompressed

      public abstract WritableByteChannel writeCompressed(WritableByteChannel channel) throws IOException
      Throws:
      IOException