You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by je...@apache.org on 2003/12/30 16:19:45 UTC

cvs commit: jakarta-commons-sandbox/io/src/java/org/apache/commons/io/output ByteArrayOutputStream.java

jeremias    2003/12/30 07:19:45

  Modified:    io/src/java/org/apache/commons/io/output
                        ByteArrayOutputStream.java
  Log:
  Removed System.out calls.
  
  Revision  Changes    Path
  1.5       +6 -17     jakarta-commons-sandbox/io/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java
  
  Index: ByteArrayOutputStream.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/output/ByteArrayOutputStream.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ByteArrayOutputStream.java	30 Dec 2003 06:55:59 -0000	1.4
  +++ ByteArrayOutputStream.java	30 Dec 2003 15:19:45 -0000	1.5
  @@ -91,8 +91,6 @@
    */
   public class ByteArrayOutputStream extends OutputStream {
   
  -    private static boolean DEBUG = false;
  -
       private List buffers = new java.util.ArrayList();
       private int currentBufferIndex;
       private int filledBufferSum;
  @@ -132,17 +130,14 @@
       }*/
       
       private void needNewBuffer(int newcount) {
  -        if (DEBUG) System.out.println("Need new buffer: newcount=" + newcount
  -                + " curBufIdx=" + currentBufferIndex
  -                + " buffers=" + buffers.size());
           if (currentBufferIndex < buffers.size() - 1) {
  +            //Recycling old buffer
               filledBufferSum += currentBuffer.length;
               
               currentBufferIndex++;
               currentBuffer = getBuffer(currentBufferIndex);
  -            if (DEBUG) System.out.println("-->Recycling old buffer: size=" 
  -                        + currentBuffer.length);
           } else {
  +            //Creating new buffer
               int newBufferSize;
               if (currentBuffer == null) {
                   newBufferSize = newcount;
  @@ -154,7 +149,6 @@
                   filledBufferSum += currentBuffer.length;
               }
               
  -            if (DEBUG) System.out.println("-->Adding new buffer: size=" + newBufferSize);
               currentBufferIndex++;
               currentBuffer = new byte[newBufferSize];
               buffers.add(currentBuffer);
  @@ -174,16 +168,11 @@
           } else if (len == 0) {
               return;
           }
  -        if (DEBUG) System.out.println("------------------write("+len+" bytes)");
           int newcount = count + len;
           int remaining = len;
           int inBufferPos = count - filledBufferSum;
           while (remaining > 0) {
               int part = Math.min(remaining, currentBuffer.length - inBufferPos);
  -            if (DEBUG) System.out.println("Writing " + part 
  -                    + " bytes at pos " + inBufferPos + " of buffer "
  -                    + currentBuffer + " len=" + currentBuffer.length
  -                    + " idx=" + currentBufferIndex);
               System.arraycopy(b, off + len - remaining, currentBuffer, inBufferPos, part);
               remaining -= part;
               if (remaining > 0) {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org