pfx-io:streamCompressedFile
This method processes GZIP and ZIP files by streaming them, eliminating the need to load the entire file into memory. It automatically detects the file type based on the file extensions, allowing for seamless integration with Camel routes.
When used with GZIP or ZIP files, the method reads the file in chunks and converts the file body to the appropriate input stream (GZIPInputStream
or ZipInputStream
) based on the detected file type. This enables efficient processing of large files without encountering out-of-memory issues.
When used with a normal input stream, no transformation is applied, but the method still provides the advantage of automatically detecting the file type. This allows users to handle different types of input streams without explicitly checking the file type.
Properties
No properties.
Examples
<route id="importProducts">
    <from uri="file:{{data.directory}}/import/p?noop=true"/>
    <to uri="pfx-io:streamCompressedFile"/>
    <split strategyRef="recordsCountAggregation" streaming="true">
        <tokenize group="10000" token="\n"/>
        <to uri="pfx-csv:unmarshal?skipHeaderRecord=true"/>
        <to uri="pfx-api:loaddata?objectType=P&mapper=pfxProductLoadMapper"/>
    </split>
</route>
IntegrationManager version 5.8.0