Package org.apache.http.io

Examples of org.apache.http.io.CharArrayBuffer.toCharArray()


   
    public void testSimpleAppend() throws Exception {
      CharArrayBuffer buffer = new CharArrayBuffer(16);
      assertEquals(16, buffer.capacity());
      assertEquals(0, buffer.length());
      char[] b1 = buffer.toCharArray();
      assertNotNull(b1);
      assertEquals(0, b1.length);
      assertTrue(buffer.isEmpty());
        assertFalse(buffer.isFull());
     
View Full Code Here


      assertEquals(16, buffer.capacity());
      assertEquals(4, buffer.length());
      assertFalse(buffer.isEmpty());
        assertFalse(buffer.isFull());
     
      char[] b2 = buffer.toCharArray();
      assertNotNull(b2);
      assertEquals(4, b2.length);
      for (int i = 0; i < tmp.length; i++) {
          assertEquals(tmp[i], b2[i]);
          assertEquals(tmp[i], buffer.charAt(i));
View Full Code Here

    public void testAppendISOByteArray() throws Exception {
        byte[] b = new byte[] {0x00, 0x20, 0x7F, -0x80, -0x01};
       
        CharArrayBuffer buffer = new CharArrayBuffer(8);
        buffer.append(b, 0, b.length);
        char[] ch = buffer.toCharArray();
        assertNotNull(ch);
        assertEquals(5, ch.length);
        assertEquals(0x00, ch[0]);
        assertEquals(0x20, ch[1]);
        assertEquals(0x7F, ch[2]);
View Full Code Here

   
    public void testSimpleAppend() throws Exception {
      CharArrayBuffer buffer = new CharArrayBuffer(16);
      assertEquals(16, buffer.capacity());
      assertEquals(0, buffer.length());
      char[] b1 = buffer.toCharArray();
      assertNotNull(b1);
      assertEquals(0, b1.length);
      assertTrue(buffer.isEmpty());
        assertFalse(buffer.isFull());
     
View Full Code Here

      assertEquals(16, buffer.capacity());
      assertEquals(4, buffer.length());
      assertFalse(buffer.isEmpty());
        assertFalse(buffer.isFull());
     
      char[] b2 = buffer.toCharArray();
      assertNotNull(b2);
      assertEquals(4, b2.length);
      for (int i = 0; i < tmp.length; i++) {
          assertEquals(tmp[i], b2[i]);
          assertEquals(tmp[i], buffer.charAt(i));
View Full Code Here

    public void testAppendISOByteArray() throws Exception {
        byte[] b = new byte[] {0x00, 0x20, 0x7F, -0x80, -0x01};
       
        CharArrayBuffer buffer = new CharArrayBuffer(8);
        buffer.append(b, 0, b.length);
        char[] ch = buffer.toCharArray();
        assertNotNull(ch);
        assertEquals(5, ch.length);
        assertEquals(0x00, ch[0]);
        assertEquals(0x20, ch[1]);
        assertEquals(0x7F, ch[2]);
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.