public class TarFilePacker extends java.lang.Object implements FilePacker
Modifier and Type | Field and Description |
---|---|
private com.ice.tar.TarOutputStream |
tar |
Constructor and Description |
---|
TarFilePacker()
Creates a new TarFilePacker.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Finish the TAR file.
|
java.lang.String |
getDescription()
Get a short description of this file format that is suitable for display in
selection list boxes.
|
java.lang.String |
getFileExtension()
Gets the extension that files, packed with this tool, should have,
for example,
zip or tar.gz Don't include the first
dot! |
java.lang.String |
getMimeType()
Gets the MIME type to give compressed files from this packer
|
void |
pack(java.lang.String entryName,
java.io.InputStream in,
long size,
long lastModified)
Create a new
TarEntry and write the compressed
data to it. |
void |
setOutputStream(java.io.OutputStream out)
Wrap the output stream in a
TarOutputStream . |
public java.lang.String getDescription()
FilePacker
getDescription
in interface FilePacker
public java.lang.String getFileExtension()
FilePacker
zip
or tar.gz
Don't include the first
dot!getFileExtension
in interface FilePacker
public java.lang.String getMimeType()
FilePacker
getMimeType
in interface FilePacker
public void setOutputStream(java.io.OutputStream out) throws java.io.IOException
TarOutputStream
.setOutputStream
in interface FilePacker
out
- The output stream to write tojava.io.IOException
- If there is an error setting the output streampublic void pack(java.lang.String entryName, java.io.InputStream in, long size, long lastModified) throws java.io.IOException
TarEntry
and write the compressed
data to it.pack
in interface FilePacker
entryName
- The name of the packed resource, including path
informationin
- The input stream to read uncompressed data from, or null
if the entry represents a directorysize
- The number of bytes of uncompressed datalastModified
- The time the contents was last modified, or 0
if not knownjava.io.IOException
- If there are any errors when reading or writingpublic void close() throws java.io.IOException
close
in interface java.lang.AutoCloseable
close
in interface FilePacker
java.io.IOException
- If there are any errors