Removed unused methods from CharBuffer
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1297078 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fa5dca3be1
commit
a53c76b43a
|
@ -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<EFBFBD>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 <code>c</code>.
|
||||
* It is also the index at which a new character will be inserted into <code>c</code>.
|
||||
*/
|
||||
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 <code>sb</code> 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 <code>data</code> 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!
|
||||
|
|
|
@ -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());
|
||||
|
||||
|
|
Loading…
Reference in New Issue