Class UnixCompressFilter
- All Implemented Interfaces:
DataFilter
- Since:
- 9.2
- Author:
- Luc Maisonobe
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
UnixCompressFilter
public UnixCompressFilter()Empty constructor.This constructor is not strictly necessary, but it prevents spurious javadoc warnings with JDK 18 and later.
- Since:
- 12.0
-
-
Method Details
-
filter
Filter the data source.Filtering is often based on suffix. For example a gzip compressed file will have an original name of the form base.ext.gz when the corresponding uncompressed file will have a filtered name base.ext.
A filter must never
opentheDataSourceby itself, regardless of the fact it will return the original instance or a filtered instance. The rationale is that it is the upper layer that will decide to open (or not) the returned value and that aDataSourcecan be opened only once; this is the core principle of lazy-opening provided byDataSource.Beware that as the
data providers managerwill attempt to pile all filters in a stack as long as their implementation of this method returns a value different from theoriginalparameter. This implies that the filter, must perform some checks to see if it must be applied or not. If for example there is a need for a deciphering filter to be applied once to all data, then the filter should for example check for a suffix in thenameand create a new filteredDataSourceinstance only if the suffix is present, removing the suffix from the filtered instance. Failing to do so and simply creating a filtered instance with one deciphering layer without changing the name would result in an infinite stack of deciphering filters being built, until a stack overflow or memory exhaustion exception occurs.- Specified by:
filterin interfaceDataFilter- Parameters:
original- original data source- Returns:
- filtered data source, or
originalif this filter does not apply to this data source
-