public final class ContentsTransformations
extends java.lang.Object
ContentsTransformer.| Modifier and Type | Field and Description |
|---|---|
static ContentsTransformer |
COPY
A
ContentsTransformer which IoUtil.copy(InputStream, OutputStream)s all data unmodified and
returns the number of copied bytes. |
| Modifier and Type | Method and Description |
|---|---|
static CompressUtil.ArchiveHandler<java.lang.Void> |
archiveHandler(java.lang.String path,
java.io.OutputStream os,
Predicate<? super java.lang.String> archiveEntryRemoval,
Glob archiveEntryRenaming,
ContentsTransformer contentsTransformer,
FileTransformations.ArchiveCombiner archiveFileCombiner,
ExceptionHandler<java.io.IOException> exceptionHandler)
Creates and returns an
CompressUtil.ArchiveHandler which transforms ArchiveInputStreams into ArchiveOutputStreams, honoring the given archiveEntryRemoval, archiveEntryRenaming and archiveEntryAddition, and using the given contentsTransformer. |
static ContentsTransformer |
compressedAndArchiveContentsTransformer(Predicate<? super java.lang.String> lookIntoFormat,
Predicate<? super java.lang.String> archiveEntryRemoval,
Glob archiveEntryRenaming,
ContentsTransformer archiveEntryContentsTransformer,
FileTransformations.ArchiveCombiner archiveCombiner,
ContentsTransformer compressedContentsTransformer,
ContentsTransformer normalContentsTransformer,
ExceptionHandler<java.io.IOException> exceptionHandler)
Returns a
ContentsTransformer which transforms contents by feeding it through the normalContentsTransformer, but automagically detects various archive and compression formats and processes the
entries of the archive and the uncompressed contents instead of the "raw" contents. |
static CompressUtil.CompressorHandler<java.lang.Void> |
compressorHandler(java.lang.String path,
java.io.OutputStream os,
ContentsTransformer contentsTransformer)
Creates and returns a
CompressUtil.CompressorHandler which transforms an ArchiveInputStream into an OutputStream, using the given contentsTransformer. |
static CompressUtil.NormalContentsHandler<java.lang.Void> |
normalContentsHandler(java.lang.String path,
java.io.OutputStream os,
ContentsTransformer contentsTransformer)
Creates and returns a handler which transforms an
InputStream into an OutputStream using the
given contentsTransformer. |
static ContentsTransformer |
recursiveCompressedAndArchiveContentsTransformer(Predicate<? super java.lang.String> lookIntoFormat,
Predicate<? super java.lang.String> archiveEntryRemoval,
Glob archiveEntryRenaming,
FileTransformations.ArchiveCombiner archiveCombiner,
ContentsTransformer delegate,
ExceptionHandler<java.io.IOException> exceptionHandler)
Returns a
ContentsTransformer which transforms a stream by feeding it through the delegate, but
automagically detects various archive formats and compression formats (also nested) and processes the
entries of the archive and the uncompressed contents instead of the "raw" contents. |
static void |
transformArchive(java.lang.String path,
org.apache.commons.compress.archivers.ArchiveInputStream archiveInputStream,
org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream,
Predicate<? super java.lang.String> archiveEntryRemoval,
Glob archiveEntryRenaming,
ContentsTransformer contentsTransformer,
FileTransformations.ArchiveCombiner archiveCombiner,
ExceptionHandler<java.io.IOException> exceptionHandler)
Transforms the given
archiveInputStream into the given archiveOutputStream, honoring the given
archiveEntryRemoval, archiveEntryRenaming and archiveEntryAddition, and using the given
contentsTransformer. |
public static final ContentsTransformer COPY
ContentsTransformer which IoUtil.copy(InputStream, OutputStream)s all data unmodified and
returns the number of copied bytes.public static ContentsTransformer compressedAndArchiveContentsTransformer(Predicate<? super java.lang.String> lookIntoFormat, Predicate<? super java.lang.String> archiveEntryRemoval, Glob archiveEntryRenaming, ContentsTransformer archiveEntryContentsTransformer, FileTransformations.ArchiveCombiner archiveCombiner, ContentsTransformer compressedContentsTransformer, ContentsTransformer normalContentsTransformer, ExceptionHandler<java.io.IOException> exceptionHandler)
ContentsTransformer which transforms contents by feeding it through the normalContentsTransformer, but automagically detects various archive and compression formats and processes the
entries of the archive and the uncompressed contents instead of the "raw" contents.
Archive files and compressed files are introspected iff lookIntoFormat evaluates true for
"format:path".
public static ContentsTransformer recursiveCompressedAndArchiveContentsTransformer(Predicate<? super java.lang.String> lookIntoFormat, Predicate<? super java.lang.String> archiveEntryRemoval, Glob archiveEntryRenaming, FileTransformations.ArchiveCombiner archiveCombiner, ContentsTransformer delegate, ExceptionHandler<java.io.IOException> exceptionHandler)
ContentsTransformer which transforms a stream by feeding it through the delegate, but
automagically detects various archive formats and compression formats (also nested) and processes the
entries of the archive and the uncompressed contents instead of the "raw" contents.
Archive streams/entries and compressed streams/entries are introspected iff lookIntoFormat evaluates
true for "format:path".
public static void transformArchive(java.lang.String path,
org.apache.commons.compress.archivers.ArchiveInputStream archiveInputStream,
org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream,
Predicate<? super java.lang.String> archiveEntryRemoval,
Glob archiveEntryRenaming,
ContentsTransformer contentsTransformer,
FileTransformations.ArchiveCombiner archiveCombiner,
ExceptionHandler<java.io.IOException> exceptionHandler)
throws java.io.IOException
archiveInputStream into the given archiveOutputStream, honoring the given
archiveEntryRemoval, archiveEntryRenaming and archiveEntryAddition, and using the given
contentsTransformer.java.io.IOExceptionpublic static CompressUtil.ArchiveHandler<java.lang.Void> archiveHandler(java.lang.String path, java.io.OutputStream os, Predicate<? super java.lang.String> archiveEntryRemoval, Glob archiveEntryRenaming, ContentsTransformer contentsTransformer, FileTransformations.ArchiveCombiner archiveFileCombiner, ExceptionHandler<java.io.IOException> exceptionHandler)
CompressUtil.ArchiveHandler which transforms ArchiveInputStreams into ArchiveOutputStreams, honoring the given archiveEntryRemoval, archiveEntryRenaming and archiveEntryAddition, and using the given contentsTransformer.public static CompressUtil.CompressorHandler<java.lang.Void> compressorHandler(java.lang.String path, java.io.OutputStream os, ContentsTransformer contentsTransformer)
CompressUtil.CompressorHandler which transforms an ArchiveInputStream into an OutputStream, using the given contentsTransformer.public static CompressUtil.NormalContentsHandler<java.lang.Void> normalContentsHandler(java.lang.String path, java.io.OutputStream os, ContentsTransformer contentsTransformer)
InputStream into an OutputStream using the
given contentsTransformer.