Added extra constructor to DecoderStream to allow for correct IFF reading.

Doc clean-up.
This commit is contained in:
Harald Kuhr 2009-11-04 01:21:10 +01:00
parent 8572633686
commit ecc79e0478
2 changed files with 18 additions and 3 deletions

View File

@ -52,6 +52,7 @@ public final class DecoderStream extends FilterInputStream {
/** /**
* Creates a new decoder stream and chains it to the * Creates a new decoder stream and chains it to the
* input stream specified by the {@code pStream} argument. * input stream specified by the {@code pStream} argument.
* The stream will use a default decode buffer size.
* *
* @param pStream the underlying input stream. * @param pStream the underlying input stream.
* @param pDecoder the decoder that will be used to decode the underlying stream * @param pDecoder the decoder that will be used to decode the underlying stream
@ -59,9 +60,23 @@ public final class DecoderStream extends FilterInputStream {
* @see java.io.FilterInputStream#in * @see java.io.FilterInputStream#in
*/ */
public DecoderStream(final InputStream pStream, final Decoder pDecoder) { public DecoderStream(final InputStream pStream, final Decoder pDecoder) {
this(pStream, pDecoder, 1024);
}
/**
* Creates a new decoder stream and chains it to the
* input stream specified by the {@code pStream} argument.
*
* @param pStream the underlying input stream.
* @param pDecoder the decoder that will be used to decode the underlying stream
* @param pBufferSize the size of the decode buffer
*
* @see java.io.FilterInputStream#in
*/
public DecoderStream(final InputStream pStream, final Decoder pDecoder, final int pBufferSize) {
super(pStream); super(pStream);
mDecoder = pDecoder; mDecoder = pDecoder;
mBuffer = new byte[1024]; mBuffer = new byte[pBufferSize];
mBufferPos = 0; mBufferPos = 0;
mBufferLimit = 0; mBufferLimit = 0;
} }
@ -142,7 +157,7 @@ public final class DecoderStream extends FilterInputStream {
// Skip until we have skipped pLength bytes, or have reached EOF // Skip until we have skipped pLength bytes, or have reached EOF
long total = 0; long total = 0;
while (total < pLength) { while (total < pLength) {
int avail = mBufferLimit - mBufferPos; int avail = mBufferLimit - mBufferPos;

View File

@ -75,7 +75,7 @@ public final class PackBitsDecoder implements Decoder {
} }
/** /**
* Creates a {@code PackBitsDecoder}. * Creates a {@code PackBitsDecoder}, with optional compatibility mode.
* <p/> * <p/>
* As some implementations of PackBits-like encoders treat {@code -128} as length of * As some implementations of PackBits-like encoders treat {@code -128} as length of
* a compressed run, instead of a no-op, it's possible to disable no-ops * a compressed run, instead of a no-op, it's possible to disable no-ops