public class TarFilePacker extends 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.
|
String |
getDescription()
Get a short description of this file format that is suitable for display in
selection list boxes.
|
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! |
String |
getMimeType()
Gets the MIME type to give compressed files from this packer
|
void |
pack(String entryName,
InputStream in,
long size,
long lastModified)
Create a new
TarEntry and write the compressed
data to it. |
void |
setOutputStream(OutputStream out)
Wrap the output stream in a
TarOutputStream . |
public String getDescription()
FilePacker
getDescription
in interface FilePacker
public String getFileExtension()
FilePacker
zip
or tar.gz
Don't include the first
dot!getFileExtension
in interface FilePacker
public String getMimeType()
FilePacker
getMimeType
in interface FilePacker
public void setOutputStream(OutputStream out) throws IOException
TarOutputStream
.setOutputStream
in interface FilePacker
out
- The output stream to write toIOException
- If there is an error setting the output streampublic void pack(String entryName, InputStream in, long size, long lastModified) throws 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 knownIOException
- If there are any errors when reading or writingpublic void close() throws IOException
close
in interface FilePacker
IOException
- If there are any errors