|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectewe.util.Errorable
ewe.io.BasicStreamObject
ewe.io.StreamObject
ewe.zip.ZipOutputStream
This is a FilterOutputStream that writes the files into a zip archive one after another. It has a special method to start a new zip entry. The zip entries contains information about the file name size, compressed size, CRC, etc. It includes support for STORED and DEFLATED entries. This class is not thread safe.
| Field Summary | |
static int |
DEFLATED
Compression method. |
int |
level
|
static int |
STORED
Compression method. |
| Fields inherited from class ewe.io.StreamObject |
napIterations, napTime, READWRITE_CLOSED, READWRITE_ERROR, READWRITE_WOULDBLOCK |
| Fields inherited from class ewe.io.BasicStreamObject |
closed |
| Fields inherited from class ewe.util.Errorable |
error |
| Constructor Summary | |
ZipOutputStream(BasicStream out)
Creates a new Zip output stream, writing a zip archive. |
|
| Method Summary | |
boolean |
closeEntry()
Closes the current entry. |
boolean |
finish()
Finishes the stream. |
boolean |
flushStream()
This is non-blocking. |
int |
nonBlockingWrite(byte[] b,
int off,
int len)
Writes the given buffer to the current entry. |
boolean |
putNextEntry(ZipEntry entry)
Starts a new Zip entry. |
boolean |
setComment(String comment)
Set the zip file comment. |
void |
setLevel(int level)
Sets default compression level. |
boolean |
setMethod(int method)
Sets default compression method. |
| Methods inherited from class ewe.io.StreamObject |
close, closeStream, doRead, doWrite, flush, isOpen, nap, nap, nonBlockingRead, read, readAByte, readBytes, readBytes, write, writeAByte, writeBytes, writeBytes |
| Methods inherited from class ewe.io.BasicStreamObject |
getException, getName, read, read, throwIOException, toInputStream, toOutputStream, toStream, write, write |
| Methods inherited from class ewe.util.Errorable |
returnError, returnError, returnError |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, toString |
| Field Detail |
public static final int STORED
public static final int DEFLATED
public int level
| Constructor Detail |
public ZipOutputStream(BasicStream out)
out - the output stream to which the zip archive is written.| Method Detail |
public boolean setComment(String comment)
comment - the comment.
IllegalArgumentException - if UTF8 encoding of comment is
longer than 0xffff bytes.public boolean setMethod(int method)
method - the method.
IllegalArgumentException - if method is not supported.STORED,
DEFLATEDpublic void setLevel(int level)
IllegalArgumentException - if level is not supported.Deflaterpublic boolean putNextEntry(ZipEntry entry)
entry - the entry.
IOException - if an I/O error occured.
IllegalStateException - if stream was finishedpublic boolean closeEntry()
IOException - if an I/O error occured.
IllegalStateException - if no entry is active.
public int nonBlockingWrite(byte[] b,
int off,
int len)
nonBlockingWrite in interface BasicStreamnonBlockingWrite in class StreamObjectb - Source byte array holding data to be written.off - Starting index in buff for data to be written.len - Number of bytes to write - should never be zero.
IOException - if an I/O error occured.
IllegalStateException - if no entry is active.public boolean finish()
IOException - if an I/O error occured.
public boolean flushStream()
throws IOException
BasicStream
flushStream in interface BasicStreamIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||