Exemplo n.º 1
0
  @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();
  }
Exemplo n.º 2
0
  @Test
  public void write_four_chunks() throws Exception {
    final AtomicInteger numWrites = new AtomicInteger();
    OutputStreamWriter osw = getOutputStreamWriter(numWrites);

    ChunkedWriter chunked = new ChunkedWriter(osw, 10);
    chunked.write("0123456789012345678901234567891".toCharArray());
    chunked.flush();
    assertEquals(4, numWrites.get());
    chunked.close();
  }