public class ZipPackageOutput extends java.lang.Object implements PackageOutput
This class provides methods to write a ZIP file. Each entry is started with nextEntry method that needs the next entry name (file name). Closing entries is not needed, previous entry is closed when nextEntry is called or the entire file is closed with close method.
Modifier and Type | Field and Description |
---|---|
private java.io.OutputStream |
out |
private java.util.zip.ZipOutputStream |
zos |
Constructor and Description |
---|
ZipPackageOutput(java.io.OutputStream out)
Creates a new instance of ZipPackageOutput
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the file.
|
java.io.OutputStream |
getOutputStream()
Gets the output stream for current entry.
|
java.lang.String |
getSeparator()
Returns file separator used by the PackageOutput.
|
java.lang.String |
joinPath(java.lang.String path,
java.lang.String name)
Joins path and name.
|
void |
nextEntry(java.lang.String name)
Starts next entry with the specified name.
|
void |
nextEntry(java.lang.String path,
java.lang.String name)
Start a new entry in the package with the given path and name.
|
void |
removeEntry(java.lang.String name)
Ensure entry will be removed.
|
void |
removeEntry(java.lang.String path,
java.lang.String name)
Ensure entry will be removed.
|
public ZipPackageOutput(java.io.OutputStream out)
public void nextEntry(java.lang.String name) throws java.io.IOException
nextEntry
in interface PackageOutput
java.io.IOException
public void nextEntry(java.lang.String path, java.lang.String name) throws java.io.IOException
PackageOutput
nextEntry
in interface PackageOutput
java.io.IOException
public void removeEntry(java.lang.String name) throws java.io.IOException
PackageOutput
removeEntry
in interface PackageOutput
java.io.IOException
public void removeEntry(java.lang.String path, java.lang.String name) throws java.io.IOException
PackageOutput
removeEntry
in interface PackageOutput
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface PackageOutput
java.io.IOException
public void close() throws java.io.IOException
close
in interface PackageOutput
java.io.IOException
public java.lang.String getSeparator()
PackageOutput
getSeparator
in interface PackageOutput
public java.lang.String joinPath(java.lang.String path, java.lang.String name)
PackageOutput
joinPath
in interface PackageOutput
Copyright 2004-2015 Wandora Team