diff --git a/src/main/java/org/apache/commons/csv/CharBuffer.java b/src/main/java/org/apache/commons/csv/CharBuffer.java index a5241242..5b88a9c8 100644 --- a/src/main/java/org/apache/commons/csv/CharBuffer.java +++ b/src/main/java/org/apache/commons/csv/CharBuffer.java @@ -20,12 +20,10 @@ package org.apache.commons.csv; /** - * A simple StringBuffer replacement that aims to - * reduce copying as much as possible. The buffer - * grows as necessary. - * This class is not thread safe. + * A simple StringBuffer replacement that aims to reduce copying as much as possible. + * The buffer grows as necessary. This class is not thread safe. * - * @author Ortwin Gl�ck + * @author Ortwin Glück */ class CharBuffer { @@ -33,8 +31,7 @@ class CharBuffer { /** * Actually used number of characters in the array. - * It is also the index at which - * a new character will be inserted into c. + * It is also the index at which a new character will be inserted into c. */ private int length; @@ -75,8 +72,7 @@ class CharBuffer { /** * Returns the current capacity of the buffer. * - * @return the maximum number of characters that can be stored in this buffer without - * resizing it. + * @return the maximum number of characters that can be stored in this buffer without resizing it. */ public int capacity() { return c.length; @@ -110,21 +106,6 @@ class CharBuffer { append(s.toCharArray()); } - /** - * Appends sb to the end of this CharBuffer. - * This method involves copying the new data once! - * - * @param sb the StringBuffer to append or null - */ - public void append(final StringBuffer sb) { - if (sb == null) { - return; - } - provideCapacity(length + sb.length()); - sb.getChars(0, sb.length(), c, length); - length += sb.length(); - } - /** * Appends data to the end of this CharBuffer. * This method involves copying the new data once! @@ -199,18 +180,6 @@ class CharBuffer { return c[pos]; } - /** - * Converts the contents of the buffer into a StringBuffer. - * This method involves copying the new data once! - * - * @return - */ - public StringBuffer toStringBuffer() { - StringBuffer sb = new StringBuffer(length); - sb.append(c, 0, length); - return sb; - } - /** * Converts the contents of the buffer into a StringBuffer. * This method involves copying the new data once! diff --git a/src/test/java/org/apache/commons/csv/CharBufferTest.java b/src/test/java/org/apache/commons/csv/CharBufferTest.java index 24767445..b9e4b5d3 100644 --- a/src/test/java/org/apache/commons/csv/CharBufferTest.java +++ b/src/test/java/org/apache/commons/csv/CharBufferTest.java @@ -73,18 +73,6 @@ public class CharBufferTest extends TestCase { } } - public void testAppendStringBuffer() { - CharBuffer cb = new CharBuffer(1); - StringBuffer abcd = new StringBuffer("abcd"); - String expected = ""; - for (int i = 0; i < 10; i++) { - cb.append(abcd); - expected += "abcd"; - assertEquals(expected, cb.toString()); - assertEquals(4 * (i + 1), cb.length()); - } - } - public void testAppendCharBuffer() { CharBuffer cb = new CharBuffer(1); CharBuffer abcd = new CharBuffer(17); @@ -152,9 +140,6 @@ public class CharBufferTest extends TestCase { public void testAppendNull() throws Exception { CharBuffer buffer = new CharBuffer(8); - buffer.append((StringBuffer) null); - assertEquals("", buffer.toString()); - buffer.append((String) null); assertEquals("", buffer.toString());