|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
net.rim.device.api.compress.ZLibInputStream
public class ZLibInputStream
Input stream for reading a data stream compressed with the ZLib algorithm (RFC 1950, RFC 1951).
Sample code
try
{
InputStream inputStream = new
ByteArrayInputStream(compressedData);
ZLibInputStream zlibInputStream = new
ZLibInputStream(inputStream, true);
byte[] data = new byte[uncompressedSize];
zlibInputStream.read(data);
}
catch(IOException ioe)
{
}
Constructor Summary | ||
---|---|---|
ZLibInputStream(InputStream inputStream)
Creates a new ZLibInputStream instance (which requires the ZLib header and trailer wrapping to be present - see other constructor). |
||
ZLibInputStream(InputStream inputStream,
boolean noWrap)
Creates a new ZLibInputStream instance. |
||
ZLibInputStream(InputStream inputStream,
boolean noWrap,
int workingBufferSize)
Creates a new ZLibInputStream instance. |
Method Summary | ||
---|---|---|
int |
available()
Retreives number of bytes which can be read from this stream without blocking. |
|
void |
close()
Closes this stream. |
|
int |
read()
Retrieves one byte from this input stream. |
|
int |
read(byte[] buffer,
int bufferOffset,
int bufferLength)
Read specified number of bytes from this stream. |
|
long |
skip(long n)
Skips over and discards n bytes of data from this input. |
Methods inherited from class java.io.InputStream |
---|
mark, markSupported, read, reset |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ZLibInputStream(InputStream inputStream)
inputStream
- Underlying input stream to use.public ZLibInputStream(InputStream inputStream, boolean noWrap)
If noWrap
is true
, the decompressor will assume that the
ZLib 16 bit header and the 32 bit trailer checksum are not included in the
underlying input stream. This mode is necessary for PKZip/Info-ZIP and GZIP
compatibility.
inputStream
- Underlying input stream to use.noWrap
- If true, the header and trailer are not present in the underlying input stream.public ZLibInputStream(InputStream inputStream, boolean noWrap, int workingBufferSize)
If noWrap
is true
, the decompressor will assume that the
ZLib 16 bit header and the 32 bit trailer checksum are not included in the
underlying input stream. This mode is necessary for PKZip/Info-ZIP and GZIP
compatibility.
inputStream
- Underlying input stream to use.noWrap
- If true, the header and trailer are not present in the underlying input stream.workingBufferSize
- The buffer size to use for the read window; cannot be less than 1024.Method Detail |
---|
public int read() throws IOException
read
in class InputStream
IOException
- If an I/O error occurs.public int read(byte[] buffer, int bufferOffset, int bufferLength) throws IOException
read
in class InputStream
buffer
- Buffer to contain data; must be large enough to contain
desired number of bytes.bufferOffset
- First element in output parameter buffer at which to
begin writing decoded data; if not 0, then output parameter buffer must
be at least bufferOffset + bufferLength
elements long.bufferLength
- Number of bytes to read from this stream.
IOException
- If an I/O error occurs.InputStream.read()
public int available() throws IOException
available
in class InputStream
IOException
- If an I/O error occurs.public void close() throws IOException
close
in class InputStream
IOException
- If an I/O error occurs.public long skip(long n) throws IOException
n
bytes of data from this input.
skip
in class InputStream
n
- the number of bytes to be skipped.
IOException
- if an I/O error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal