ByteArrayOutputStream bout = new ByteArrayOutputStream();
exporter = new TextExporter(CS_UTF8);
+ // JRE 1.6 と 1.7 でびみょーに違う
+ float maxb = CS_UTF8.newEncoder().maxBytesPerChar();
+
exporter.setCharBufSize(1);
- exporter.setByteBufSize(4);
+ int minb = (int)( StrictMath.floor(maxb) );
+ exporter.setByteBufSize(minb);
bout.reset();
try{
exporter.encodeToByteStream("あいう", bout);
assertEquals(9, bout.size());
try{
- exporter.setByteBufSize(3);
+ int failSize = minb - 1;
+ exporter.setByteBufSize(failSize);
fail();
}catch(IllegalArgumentException e){
// GOOD