Package java.io

Examples of java.io.CharArrayWriter.toCharArray()


    try {
      CharArrayWriter writer = new CharArrayWriter();
      char[] source = stringLineBreak.toCharArray();
      HTMLEncoder.encode(source, 4, source.length - 5, writer);
      char[] expected = stringLineBreakEncoded2Partial.toCharArray();
      assertEquals(expected, writer.toCharArray());
    } catch (IOException e) {
      fail(e.getMessage());
    }
  }
View Full Code Here


            runTests(in, out);
            out.close();
            in.close();

            LineNumberReader expected = new LineNumberReader(new InputStreamReader(getClass().getResourceAsStream("parserTestsOutput.txt"), UTF8));
            LineNumberReader actual = new LineNumberReader(new CharArrayReader(writer.toCharArray()));

            Assert.assertFalse(isDifferentStreams(actual, expected));
            actual.close();
            expected.close();
        } finally {
View Full Code Here

    Writer tee = new TeeWriter(w1, w2);
    String data = new String(DATA);
    tee.append(data);
    tee.flush();
    assertArrayEquals(DATA, w1.toCharArray());
    assertArrayEquals(DATA, w2.toCharArray());

    w1 = new CharArrayWriter();
    w2 = new CharArrayWriter();
    tee = new TeeWriter(w1, w2);
    tee.append(data, 0, 6);
View Full Code Here

    tee = new TeeWriter(w1, w2);
    tee.append(data, 0, 6);
    tee.append(data, 6, 13);
    tee.flush();
    assertArrayEquals(DATA, w1.toCharArray());
    assertArrayEquals(DATA, w2.toCharArray());
  }

  @Test
  public void testWriteChar() throws IOException
  {
View Full Code Here

    for (char c : DATA) {
      tee.write(c);
    }
    tee.flush();
    assertArrayEquals(DATA, w1.toCharArray());
    assertArrayEquals(DATA, w2.toCharArray());
  }

  @Test
  public void testWriteCharArray() throws IOException
  {
View Full Code Here

    CharArrayWriter w2 = new CharArrayWriter();
    Writer tee = new TeeWriter(w1, w2);
    tee.write(DATA);
    tee.flush();
    assertArrayEquals(DATA, w1.toCharArray());
    assertArrayEquals(DATA, w2.toCharArray());

    w1 = new CharArrayWriter();
    w2 = new CharArrayWriter();
    tee = new TeeWriter(w1, w2);
    tee.write(DATA, 0, 6);
View Full Code Here

    tee = new TeeWriter(w1, w2);
    tee.write(DATA, 0, 6);
    tee.write(DATA, 6, 7);
    tee.flush();
    assertArrayEquals(DATA, w1.toCharArray());
    assertArrayEquals(DATA, w2.toCharArray());
  }

  @Test
  public void testWriteString() throws IOException
  {
View Full Code Here

    Writer tee = new TeeWriter(w1, w2);
    String data = new String(DATA);
    tee.write(data);
    tee.flush();
    assertArrayEquals(DATA, w1.toCharArray());
    assertArrayEquals(DATA, w2.toCharArray());

    w1 = new CharArrayWriter();
    w2 = new CharArrayWriter();
    tee = new TeeWriter(w1, w2);
    tee.write(data, 0, 6);
View Full Code Here

    tee = new TeeWriter(w1, w2);
    tee.write(data, 0, 6);
    tee.write(data, 6, 7);
    tee.flush();
    assertArrayEquals(DATA, w1.toCharArray());
    assertArrayEquals(DATA, w2.toCharArray());
  }

  @Test
  public void testFlush() throws IOException
  {
View Full Code Here

    for (char c : DATA) {
      tee.append(c);
    }
    tee.flush();
    assertArrayEquals(DATA, w1.toCharArray());
    assertArrayEquals(DATA, w2.toCharArray());
  }

  @Test
  public void testAppendCharSequence() throws IOException
  {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.