public class SevenZOutputFile extends Objectimplements Closeable
| Constructor and Description |
|---|
SevenZOutputFile(File
Opens file to write a 7z archive to.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes the archive, calling
finish() if necessary.
|
void |
closeArchiveEntry()
Closes the archive entry.
|
SevenZArchiveEntry |
createArchiveEntry(File
Create an archive entry using the inputFile and entryName provided.
|
void |
finish()
Finishes the addition of entries to this archive, without closing it.
|
void |
putArchiveEntry(ArchiveEntry
Records an archive entry to add.
|
void |
setContentCompression(SevenZMethod
Sets the default compression method to use for entry contents - the default is LZMA2.
|
void |
setContentMethods(Iterable
Sets the default (compression) methods to use for entry contents - the default is LZMA2.
|
void |
write(byte[] b)
Writes a byte array to the current archive entry.
|
void |
write(byte[] b, int off, int len)
Writes part of a byte array to the current archive entry.
|
void |
write(int b)
Writes a byte to the current archive entry.
|
public SevenZOutputFile(Filefilename) throws IOException
filename - name of the file to write to
IOException - if opening the file fails
public void setContentCompression(SevenZMethodmethod)
Currently only SevenZMethod, SevenZMethod, SevenZMethod and SevenZMethod are supported.
This is a short form for passing a single-element iterable to setContentMethods(java.lang.Iterable<? extends org.apache.commons.compress.archivers.sevenz.SevenZMethodConfiguration>).
public void setContentMethods(Iterable<? extends SevenZMethodConfiguration > methods)
Currently only SevenZMethod, SevenZMethod, SevenZMethod and SevenZMethod are supported.
The methods will be consulted in iteration order to create the final output.
public void close()
throws IOException
finish() if necessary.
close in interface
Closeable
close in interface
AutoCloseable
IOException -
public SevenZArchiveEntrycreateArchiveEntry(File inputFile, String entryName) throws IOException
inputFile -
entryName -
IOException -
public void putArchiveEntry(ArchiveEntryarchiveEntry) throws IOException
closeArchiveEntry() to complete the process.
archiveEntry - describes the entry
IOException -
public void closeArchiveEntry()
throws IOException
IOException -
public void write(int b)
throws IOException
b - The byte to be written.
IOException - on error
public void write(byte[] b)
throws IOException
b - The byte array to be written.
IOException - on error
public void write(byte[] b,
int off,
int len)
throws IOException
b - The byte array to be written.
off - offset into the array to start writing from
len - number of bytes to write
IOException - on error
public void finish()
throws IOException
IOException - if archive is already closed.