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;
/**
* 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/>
*
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>

View File

@ -47,13 +47,13 @@ import java.io.IOException;
public interface Decoder {
/**
* Decodes up to {@code pBuffer.length} bytes from the given inputstream,
* Decodes up to {@code pBuffer.length} bytes from the given input stream,
* into the given buffer.
*
* @param pStream the inputstream to decode data from
* @param pStream the input stream to decode data from
* @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.
*
* @throws DecodeException if encoded data is corrupt

View File

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

View File

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