@Test public void write_two_chunks_default_constructor() throws Exception { final AtomicInteger numWrites = new AtomicInteger(); OutputStreamWriter osw = getOutputStreamWriter(numWrites); ChunkedWriter chunked = new ChunkedWriter(osw); chunked.write(new char[1024 * 4 + 1]); chunked.flush(); assertEquals(2, numWrites.get()); chunked.close(); }
@Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } }
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } }
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter(final Writer writer, int chunkSize);  ChunkedWriter(final Writer writer); }
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter(final Writer writer, int chunkSize);  ChunkedWriter(final Writer writer); @Override void write(char[] data, int srcOffset, int length); }
ChunkedWriter extends FilterWriter { @Override public void write(char[] data, int srcOffset, int length) throws IOException { int bytes = length; int dstOffset = srcOffset; while(bytes > 0) { int chunk = Math.min(bytes, chunkSize); out.write(data, dstOffset, chunk); bytes -= chunk; dstOffset += chunk; } } ChunkedWriter(final Writer writer, int chunkSize);  ChunkedWriter(final Writer writer); @Override void write(char[] data, int srcOffset, int length);  }