Skip to content

Commit a53c76b

Browse files
committed
Removed unused methods from CharBuffer
git-svn-id: https://svn.apache.org/repos/asf/commons/sandbox/csv/trunk@1297078 13f79535-47bb-0310-9956-ffa450edef68
1 parent fa5dca3 commit a53c76b

2 files changed

Lines changed: 5 additions & 51 deletions

File tree

src/main/java/org/apache/commons/csv/CharBuffer.java

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,18 @@
2020
package org.apache.commons.csv;
2121

2222
/**
23-
* A simple StringBuffer replacement that aims to
24-
* reduce copying as much as possible. The buffer
25-
* grows as necessary.
26-
* This class is not thread safe.
23+
* A simple StringBuffer replacement that aims to reduce copying as much as possible.
24+
* The buffer grows as necessary. This class is not thread safe.
2725
*
28-
* @author Ortwin Gl�ck
26+
* @author Ortwin Glück
2927
*/
3028
class CharBuffer {
3129

3230
private char[] c;
3331

3432
/**
3533
* Actually used number of characters in the array.
36-
* It is also the index at which
37-
* a new character will be inserted into <code>c</code>.
34+
* It is also the index at which a new character will be inserted into <code>c</code>.
3835
*/
3936
private int length;
4037

@@ -75,8 +72,7 @@ public int length() {
7572
/**
7673
* Returns the current capacity of the buffer.
7774
*
78-
* @return the maximum number of characters that can be stored in this buffer without
79-
* resizing it.
75+
* @return the maximum number of characters that can be stored in this buffer without resizing it.
8076
*/
8177
public int capacity() {
8278
return c.length;
@@ -110,21 +106,6 @@ public void append(final String s) {
110106
append(s.toCharArray());
111107
}
112108

113-
/**
114-
* Appends <code>sb</code> to the end of this CharBuffer.
115-
* This method involves copying the new data once!
116-
*
117-
* @param sb the StringBuffer to append or null
118-
*/
119-
public void append(final StringBuffer sb) {
120-
if (sb == null) {
121-
return;
122-
}
123-
provideCapacity(length + sb.length());
124-
sb.getChars(0, sb.length(), c, length);
125-
length += sb.length();
126-
}
127-
128109
/**
129110
* Appends <code>data</code> to the end of this CharBuffer.
130111
* This method involves copying the new data once!
@@ -199,18 +180,6 @@ public char charAt(int pos) {
199180
return c[pos];
200181
}
201182

202-
/**
203-
* Converts the contents of the buffer into a StringBuffer.
204-
* This method involves copying the new data once!
205-
*
206-
* @return
207-
*/
208-
public StringBuffer toStringBuffer() {
209-
StringBuffer sb = new StringBuffer(length);
210-
sb.append(c, 0, length);
211-
return sb;
212-
}
213-
214183
/**
215184
* Converts the contents of the buffer into a StringBuffer.
216185
* This method involves copying the new data once!

src/test/java/org/apache/commons/csv/CharBufferTest.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -73,18 +73,6 @@ public void testAppendString() {
7373
}
7474
}
7575

76-
public void testAppendStringBuffer() {
77-
CharBuffer cb = new CharBuffer(1);
78-
StringBuffer abcd = new StringBuffer("abcd");
79-
String expected = "";
80-
for (int i = 0; i < 10; i++) {
81-
cb.append(abcd);
82-
expected += "abcd";
83-
assertEquals(expected, cb.toString());
84-
assertEquals(4 * (i + 1), cb.length());
85-
}
86-
}
87-
8876
public void testAppendCharBuffer() {
8977
CharBuffer cb = new CharBuffer(1);
9078
CharBuffer abcd = new CharBuffer(17);
@@ -152,9 +140,6 @@ public void testAppendString2() throws Exception {
152140
public void testAppendNull() throws Exception {
153141
CharBuffer buffer = new CharBuffer(8);
154142

155-
buffer.append((StringBuffer) null);
156-
assertEquals("", buffer.toString());
157-
158143
buffer.append((String) null);
159144
assertEquals("", buffer.toString());
160145

0 commit comments

Comments
 (0)