public class ZipStream extends CompressedStream
Modifier and Type | Field and Description |
---|---|
static int |
DEFLATED
Compression method for compressed (DEFLATED) entries.
|
static int |
STORED
Compression method for uncompressed (STORED) entries.
|
compressedStream, DEFLATE, INFLATE, mode
skipBuffer
Constructor and Description |
---|
ZipStream(RandomAccessStream stream,
int mode)
Creates a new ZIP stream that may be used to read compressed data from the given stream, or to write compressed
data to the given stream.
|
Modifier and Type | Method and Description |
---|---|
int |
available()
Returns 0 after EOF has reached for the current entry data, otherwise always return 1.
Programs should not count on this method to return the actual number of bytes that could be read without blocking. |
void |
close()
Closes this stream WITHOUT closing the underlying stream, which must be explicitly closed by the user.
|
void |
closeEntry()
Closes the current ZIP entry and positions the stream for reading (INFLATE) or writing (DEFLATE) the next entry.
|
protected java.lang.Object |
createDeflate(Stream stream) |
protected java.lang.Object |
createInflate(Stream stream) |
ZipEntry |
getNextEntry()
Reads the next ZIP file entry and positions the stream at the beginning of the entry data.
|
void |
putNextEntry(ZipEntry entry)
Begins writing a new ZIP file entry and positions the stream to the start of the entry data.
|
finalize, readBytes, writeBytes
asInputStream, asOutputStream, asStream, asStream, skipBytes, wrapInputStream, wrapInputStreamToStream, write, writeBytes, writeBytes, writeBytes
public static final int STORED
public static final int DEFLATED
public ZipStream(RandomAccessStream stream, int mode)
stream
- input stream.mode
- its value must be either DEFLATE or INFLATE.protected java.lang.Object createDeflate(Stream stream)
createDeflate
in class CompressedStream
protected java.lang.Object createInflate(Stream stream)
createInflate
in class CompressedStream
public int available() throws IOException
IOException
- if an I/O error occurs.public ZipEntry getNextEntry() throws IOException
IOException
- if an I/O error has occurredpublic void putNextEntry(ZipEntry entry) throws IOException, ZipException
entry
- the ZIP entry to be writtenIOException
- if an I/O error has occurredZipException
public void closeEntry() throws IOException, ZipException
IOException
- if an I/O error has occurredZipException
public void close() throws IOException
CompressedStream
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class CompressedStream
IOException
- If an I/O error occurs.