Class CompressContent

java.lang.Object
org.apache.nifi.components.AbstractConfigurableComponent
org.apache.nifi.processor.AbstractSessionFactoryProcessor
org.apache.nifi.processor.AbstractProcessor
org.apache.nifi.processors.standard.CompressContent
All Implemented Interfaces:
org.apache.nifi.components.ConfigurableComponent, org.apache.nifi.processor.Processor

@SideEffectFree @SupportsBatching @InputRequirement(INPUT_REQUIRED) @Tags({"content","compress","decompress","gzip","bzip2","lzma","xz-lzma2","snappy","snappy-hadoop","snappy framed","lz4-framed","deflate","zstd","brotli"}) @CapabilityDescription("Compresses or decompresses the contents of FlowFiles using a user-specified compression algorithm and updates the mime.type attribute as appropriate. A common idiom is to precede CompressContent with IdentifyMimeType and configure Mode=\'decompress\' AND Compression Format=\'use mime.type attribute\'. When used in this manner, the MIME type is automatically detected and the data is decompressed, if necessary. If decompression is unnecessary, the data is passed through to the \'success\' relationship. This processor operates in a very memory efficient way so very large objects well beyond the heap size are generally fine to process.") @ReadsAttribute(attribute="mime.type", description="If the Compression Format is set to use mime.type attribute, this attribute is used to determine the compression type. Otherwise, this attribute is ignored.") @WritesAttribute(attribute="mime.type", description="If the Mode property is set to compress, the appropriate MIME Type is set. If the Mode property is set to decompress and the file is successfully decompressed, this attribute is removed, as the MIME Type is no longer known.") @SystemResourceConsideration(resource=CPU) @SystemResourceConsideration(resource=MEMORY) @UseCase(description="Compress the contents of a FlowFile",configuration="\"Mode\" = \"compress\"\n\"Compression Format\" should be set to whichever compression algorithm should be used.") @UseCase(description="Decompress the contents of a FlowFile",configuration="\"Mode\" = \"decompress\"\n\"Compression Format\" should be set to whichever compression algorithm was used to compress the data previously.") @MultiProcessorUseCase(description="Check whether or not a FlowFile is compressed and if so, decompress it.",notes="If IdentifyMimeType determines that the content is not compressed, CompressContent will pass the FlowFile along to the \'success\' relationship without attempting to decompress it.",keywords={"auto","detect","mime type","compress","decompress","gzip","bzip2"},configurations={@ProcessorConfiguration(processorClass=IdentifyMimeType.class,configuration="Default property values are sufficient.\nConnect the \'success\' relationship to CompressContent.\n"),@ProcessorConfiguration(processorClass=CompressContent.class,configuration="\"Mode\" = \"decompress\"\n\"Compression Format\" = \"use mime.type attribute\"\n")}) @DeprecationNotice(classNames="org.apache.nifi.processors.compress.ModifyCompression") public class CompressContent extends org.apache.nifi.processor.AbstractProcessor
  • Field Details

    • COMPRESSION_FORMAT_ATTRIBUTE

      public static final String COMPRESSION_FORMAT_ATTRIBUTE
      See Also:
    • COMPRESSION_FORMAT_GZIP

      public static final String COMPRESSION_FORMAT_GZIP
      See Also:
    • COMPRESSION_FORMAT_DEFLATE

      public static final String COMPRESSION_FORMAT_DEFLATE
      See Also:
    • COMPRESSION_FORMAT_BZIP2

      public static final String COMPRESSION_FORMAT_BZIP2
      See Also:
    • COMPRESSION_FORMAT_XZ_LZMA2

      public static final String COMPRESSION_FORMAT_XZ_LZMA2
      See Also:
    • COMPRESSION_FORMAT_LZMA

      public static final String COMPRESSION_FORMAT_LZMA
      See Also:
    • COMPRESSION_FORMAT_SNAPPY

      public static final String COMPRESSION_FORMAT_SNAPPY
      See Also:
    • COMPRESSION_FORMAT_SNAPPY_HADOOP

      public static final String COMPRESSION_FORMAT_SNAPPY_HADOOP
      See Also:
    • COMPRESSION_FORMAT_SNAPPY_FRAMED

      public static final String COMPRESSION_FORMAT_SNAPPY_FRAMED
      See Also:
    • COMPRESSION_FORMAT_LZ4_FRAMED

      public static final String COMPRESSION_FORMAT_LZ4_FRAMED
      See Also:
    • COMPRESSION_FORMAT_ZSTD

      public static final String COMPRESSION_FORMAT_ZSTD
      See Also:
    • COMPRESSION_FORMAT_BROTLI

      public static final String COMPRESSION_FORMAT_BROTLI
      See Also:
    • MODE_COMPRESS

      public static final String MODE_COMPRESS
      See Also:
    • MODE_DECOMPRESS

      public static final String MODE_DECOMPRESS
      See Also:
    • COMPRESSION_FORMAT

      public static final org.apache.nifi.components.PropertyDescriptor COMPRESSION_FORMAT
    • MODE

      public static final org.apache.nifi.components.PropertyDescriptor MODE
    • COMPRESSION_LEVEL

      public static final org.apache.nifi.components.PropertyDescriptor COMPRESSION_LEVEL
    • UPDATE_FILENAME

      public static final org.apache.nifi.components.PropertyDescriptor UPDATE_FILENAME
    • PROPERTY_DESCRIPTORS

      private static final List<org.apache.nifi.components.PropertyDescriptor> PROPERTY_DESCRIPTORS
    • REL_SUCCESS

      public static final org.apache.nifi.processor.Relationship REL_SUCCESS
    • REL_FAILURE

      public static final org.apache.nifi.processor.Relationship REL_FAILURE
    • RELATIONSHIPS

      private static final Set<org.apache.nifi.processor.Relationship> RELATIONSHIPS
    • compressionFormatMimeTypeMap

      private final Map<String,String> compressionFormatMimeTypeMap
  • Constructor Details

    • CompressContent

      public CompressContent()
  • Method Details

    • getRelationships

      public Set<org.apache.nifi.processor.Relationship> getRelationships()
      Specified by:
      getRelationships in interface org.apache.nifi.processor.Processor
      Overrides:
      getRelationships in class org.apache.nifi.processor.AbstractSessionFactoryProcessor
    • getSupportedPropertyDescriptors

      protected List<org.apache.nifi.components.PropertyDescriptor> getSupportedPropertyDescriptors()
      Overrides:
      getSupportedPropertyDescriptors in class org.apache.nifi.components.AbstractConfigurableComponent
    • customValidate

      protected Collection<org.apache.nifi.components.ValidationResult> customValidate(org.apache.nifi.components.ValidationContext context)
      Overrides:
      customValidate in class org.apache.nifi.components.AbstractConfigurableComponent
    • onTrigger

      public void onTrigger(org.apache.nifi.processor.ProcessContext context, org.apache.nifi.processor.ProcessSession session)
      Specified by:
      onTrigger in class org.apache.nifi.processor.AbstractProcessor
    • closeQuietly

      private void closeQuietly(Closeable closeable)