TMC-IOENC-11: Fixed problem introduced when migrating byte[] -> ByteBuffer

This commit is contained in:
Harald Kuhr
2013-09-27 14:21:31 +02:00
parent cd197afc04
commit 1acc04eeaf
5 changed files with 33 additions and 22 deletions

View File

@@ -54,7 +54,12 @@ public abstract class EncoderAbstractTestCase extends ObjectAbstractTestCase {
OutputStream out = new EncoderStream(outBytes, createEncoder(), true);
try {
out.write(data);
// Provoke failure for encoders that doesn't take array offset properly into account
int off = (data.length + 1) / 2;
out.write(data, 0, off);
if (data.length > off) {
out.write(data, off, data.length - off);
}
}
finally {
out.close();
@@ -127,4 +132,8 @@ public abstract class EncoderAbstractTestCase extends ObjectAbstractTestCase {
}
}
}
// TODO: Test that the transition from byte[] to ByteBuffer didn't introduce bugs when writing to a wrapped array with offset.
}

View File

@@ -1,10 +1,5 @@
package com.twelvemonkeys.io.enc;
import com.twelvemonkeys.io.enc.Decoder;
import com.twelvemonkeys.io.enc.Encoder;
import com.twelvemonkeys.io.enc.PackBitsDecoder;
import com.twelvemonkeys.io.enc.PackBitsEncoder;
/**
* PackBitsEncoderTest
* <p/>