Minor enhancements to the Decoder API + tests.

This commit is contained in:
Harald Kuhr 2012-05-21 23:56:47 +02:00
parent a4dfb7a009
commit 9492ed67f1
4 changed files with 9 additions and 5 deletions

View File

@ -31,7 +31,7 @@ package com.twelvemonkeys.io.enc;
import java.io.IOException; import java.io.IOException;
/** /**
* Thrown by {@code Decoder}s when encoded data can not be decocded. * Thrown by {@code Decoder}s when encoded data can not be decoded.
* <p/> * <p/>
* *
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a> * @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>

View File

@ -53,7 +53,7 @@ public interface Decoder {
* @param pStream the input stream to decode data from * @param pStream the input stream to decode data from
* @param pBuffer buffer to store the read data * @param pBuffer buffer to store the read data
* *
* @return the total number of bytes read into the buffer, or {@code -1} * @return the total number of bytes read into the buffer, or {@code 0}
* if there is no more data because the end of the stream has been reached. * if there is no more data because the end of the stream has been reached.
* *
* @throws DecodeException if encoded data is corrupt * @throws DecodeException if encoded data is corrupt

View File

@ -143,7 +143,7 @@ public final class DecoderStream extends FilterInputStream {
// Update offset (rest) // Update offset (rest)
off += dstLen; off += dstLen;
// Inrease count // Increase count
count += dstLen; count += dstLen;
} }

View File

@ -77,6 +77,10 @@ public abstract class DecoderAbstractTestCase extends ObjectAbstractTestCase {
@Test @Test
public final void testStreams() throws Exception { public final void testStreams() throws Exception {
if (createCompatibleEncoder() == null) {
return;
}
for (int i = 1; i < 100; i++) { for (int i = 1; i < 100; i++) {
try { try {
runStreamTest(i); runStreamTest(i);