public final class DumpArchiveFormat extends Object implements ArchiveFormat
Modifier and Type | Method and Description |
---|---|
org.apache.commons.compress.archivers.ArchiveInputStream |
archiveInputStream(InputStream is) |
org.apache.commons.compress.archivers.ArchiveOutputStream |
archiveOutputStream(OutputStream os) |
org.apache.commons.compress.archivers.ArchiveOutputStream |
create(File archiveFile)
Creates a new archive file.
|
static ArchiveFormat |
get()
Required by
ArchiveFormatFactory . |
String |
getArchiveFileName(String fileName)
Maps the given fileName to the name that a corresponding archive file would have.
|
String |
getName() |
boolean |
isArchiveFileName(String fileName) |
boolean |
matches(byte[] signature,
int signatureLength) |
org.apache.commons.compress.archivers.ArchiveInputStream |
open(File archiveFile)
Opens an existing archive file for reading.
|
String |
toString() |
void |
writeDirectoryEntry(org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream,
String name)
Appends a 'directory entry', i.e. an entry without contents, to the given archiveOutputStream.
|
void |
writeEntry(org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream,
org.apache.commons.compress.archivers.ArchiveEntry archiveEntry,
String name,
ConsumerWhichThrows<? super OutputStream,? extends IOException> writeContents)
Appends the given archiveEntry with the given contents to the given archiveOutputStream.
|
void |
writeEntry(org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream,
String name,
ConsumerWhichThrows<? super OutputStream,? extends IOException> writeContents)
Appends a 'normal' entry (as opposed to a 'directory entry') with the given contents to the given
archiveOutputStream . |
public static ArchiveFormat get()
ArchiveFormatFactory
.public String getName()
getName
in interface ArchiveFormat
public boolean isArchiveFileName(String fileName)
isArchiveFileName
in interface ArchiveFormat
ArchiveFormat
public String getArchiveFileName(String fileName)
ArchiveFormat
getArchiveFileName
in interface ArchiveFormat
public org.apache.commons.compress.archivers.ArchiveInputStream archiveInputStream(InputStream is) throws org.apache.commons.compress.archivers.ArchiveException
archiveInputStream
in interface ArchiveFormat
ArchiveInputStream
for this format which reads from the given
input streamorg.apache.commons.compress.archivers.StreamingNotSupportedException
- This archive format does not support streamingorg.apache.commons.compress.archivers.ArchiveException
- The contents is invalid for this archive formatpublic org.apache.commons.compress.archivers.ArchiveInputStream open(File archiveFile) throws IOException, org.apache.commons.compress.archivers.ArchiveException
ArchiveFormat
open
in interface ArchiveFormat
ArchiveInputStream
for this format which reads from the given archiveFileIOException
org.apache.commons.compress.archivers.ArchiveException
public org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream(OutputStream os) throws org.apache.commons.compress.archivers.ArchiveException
archiveOutputStream
in interface ArchiveFormat
ArchiveOutputStream
for this format which writes to the given
output streamorg.apache.commons.compress.archivers.StreamingNotSupportedException
- This archive format does not support streamingorg.apache.commons.compress.archivers.ArchiveException
- Creation of archives in in this format is not supportedpublic org.apache.commons.compress.archivers.ArchiveOutputStream create(File archiveFile) throws org.apache.commons.compress.archivers.ArchiveException
ArchiveFormat
create
in interface ArchiveFormat
ArchiveOutputStream
for this format which writes to the given archiveFile
org.apache.commons.compress.archivers.ArchiveException
- Creation of archives in this format is not supportedpublic void writeEntry(org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream, String name, ConsumerWhichThrows<? super OutputStream,? extends IOException> writeContents)
ArchiveFormat
archiveOutputStream
. The archive entry is filled with "standard values", except for the entry name.
writeContents is called exactly once unless the name designates a directory entry.
writeEntry
in interface ArchiveFormat
archiveOutputStream
- Must match this ArchiveFormat
name
- The name for the entry; may be slightly changed (in particulary wrt/ leading
and trailing slashes) before the entry is createdwriteContents
- Writes the entry's contents to the 'subject' output streamArchiveFormat.writeDirectoryEntry(ArchiveOutputStream, String)
public void writeDirectoryEntry(org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream, String name)
ArchiveFormat
writeDirectoryEntry
in interface ArchiveFormat
archiveOutputStream
- Must match this ArchiveFormat
name
- The name for the entry; may be slightly changed (in particulary wrt/
leading and trailing slashes) before the entry is createdpublic void writeEntry(org.apache.commons.compress.archivers.ArchiveOutputStream archiveOutputStream, org.apache.commons.compress.archivers.ArchiveEntry archiveEntry, @Nullable String name, ConsumerWhichThrows<? super OutputStream,? extends IOException> writeContents)
ArchiveFormat
null
, then it overrides the name in the archive entry.
If the type of the archiveEntry does not match this ArchiveFormat
, then it is automatically
converted to the correct type, preserving as much information as possible ('re-archiving').
writeContents is called exactly once unless the archiveEntry is a directory entry.
writeEntry
in interface ArchiveFormat
archiveOutputStream
- Must match this ArchiveFormat
archiveEntry
- May or may not match this ArchiveFormat
(see above)name
- Overrides the name in the archiveEntry, or null
writeContents
- Writes the entry's contents to the 'subject' output streampublic boolean matches(byte[] signature, int signatureLength)
matches
in interface ArchiveFormat
Copyright © 2018 Arno Unkrig. All rights reserved.