commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ebo...@apache.org
Subject svn commit: r1297078 - in /commons/sandbox/csv/trunk/src: main/java/org/apache/commons/csv/CharBuffer.java test/java/org/apache/commons/csv/CharBufferTest.java
Date Mon, 05 Mar 2012 15:01:43 GMT
Author: ebourg
Date: Mon Mar  5 15:01:41 2012
New Revision: 1297078

URL: http://svn.apache.org/viewvc?rev=1297078&view=rev
Log:
Removed unused methods from CharBuffer

Modified:
    commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java
    commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CharBufferTest.java

Modified: commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java?rev=1297078&r1=1297077&r2=1297078&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java (original)
+++ commons/sandbox/csv/trunk/src/main/java/org/apache/commons/csv/CharBuffer.java Mon Mar
 5 15:01:41 2012
@@ -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 <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;
@@ -111,21 +107,6 @@ class CharBuffer {
     }
 
     /**
-     * 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!
      *
@@ -205,18 +186,6 @@ class CharBuffer {
      *
      * @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!
-     *
-     * @return
-     */
     public String toString() {
         return new String(c, 0, length);
     }

Modified: commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CharBufferTest.java
URL: http://svn.apache.org/viewvc/commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CharBufferTest.java?rev=1297078&r1=1297077&r2=1297078&view=diff
==============================================================================
--- commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CharBufferTest.java (original)
+++ commons/sandbox/csv/trunk/src/test/java/org/apache/commons/csv/CharBufferTest.java Mon
Mar  5 15:01:41 2012
@@ -73,18 +73,6 @@ public class CharBufferTest extends Test
         }
     }
 
-    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 Test
     public void testAppendNull() throws Exception {
         CharBuffer buffer = new CharBuffer(8);
 
-        buffer.append((StringBuffer) null);
-        assertEquals("", buffer.toString());
-
         buffer.append((String) null);
         assertEquals("", buffer.toString());
 



Mime
View raw message