FileOutputStream fos = new FileOutputStream(new File("/temp/design.newline.out"));
ByteBuffer b = ByteBuffer.allocate(12);
NewlineFilter nlFilter = NewlineFilter.createNix2Win(true);
while (fis.getChannel().read(b) != -1) {
b.flip(); // get ready to be read
ByteBuffer f = nlFilter.filter(b);
fos.getChannel().write(f); // XXX in fact, f may not be fully consumed
if (b.hasRemaining()) {
b.compact();
} else {
b.clear();