tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@hyperreal.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/jasper/runtime BodyContentImpl.java
Date Sun, 17 Oct 1999 08:23:35 GMT
mode        99/10/17 01:23:35

  Modified:    src/share/org/apache/jasper/runtime BodyContentImpl.java
  Log:
  Some cleanup and fixed extra spaces problem
  
  Revision  Changes    Path
  1.2       +14 -35    jakarta-tomcat/src/share/org/apache/jasper/runtime/BodyContentImpl.java
  
  Index: BodyContentImpl.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/BodyContentImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BodyContentImpl.java	1999/10/14 04:08:19	1.1
  +++ BodyContentImpl.java	1999/10/17 08:23:34	1.2
  @@ -1,7 +1,7 @@
   /*
  - * $Id: BodyContentImpl.java,v 1.1 1999/10/14 04:08:19 akv Exp $
  - * $Revision: 1.1 $
  - * $Date: 1999/10/14 04:08:19 $
  + * $Id: BodyContentImpl.java,v 1.2 1999/10/17 08:23:34 mode Exp $
  + * $Revision: 1.2 $
  + * $Date: 1999/10/17 08:23:34 $
    *
    * ====================================================================
    * 
  @@ -112,10 +112,13 @@
       private void reAllocBuff (int len) {
           //Need to re-allocate the buffer since it is to be
   	//unbounded according to the updated spec..
  +
           char[] tmp = new char [bufferSize];
   	System.arraycopy(cb, 0, tmp, 0, cb.length);
  +
   	//XXX Should it be multiple of DEFAULT_BUFFER_SIZE??
  -	if (len < Constants.DEFAULT_BUFFER_SIZE) {
  +
  +	if (len <= Constants.DEFAULT_BUFFER_SIZE) {
   	    cb = new char [bufferSize + Constants.DEFAULT_BUFFER_SIZE];
   	    bufferSize += Constants.DEFAULT_BUFFER_SIZE;
   	} else {
  @@ -127,15 +130,6 @@
       }
   
       /**
  -     * Our own little min method, to avoid loading java.lang.Math if we've run
  -     * out of file descriptors and we're trying to print a stack trace.
  -     */
  -    private int min(int a, int b) {
  -	if (a < b) return a;
  -	return b;
  -    }
  -
  -    /**
        * Write a portion of an array of characters.
        *
        * <p> Ordinarily this method stores characters from the given array into
  @@ -162,21 +156,10 @@
                   return;
               } 
   
  -            if (len >= bufferSize - nextChar) {
  -                /* If the request length exceeds the size of the output buffer,
  -                   re-allocate atleast the length of the buffer. */
  +            if (len >= bufferSize - nextChar)
   		   reAllocBuff (len);
  -            }
   
  -            int b = off, t = off + len;
  -            while (b < t) {
  -                int d = min(bufferSize - nextChar, t - b);
  -                System.arraycopy(cbuf, b, cb, nextChar, d);
  -                b += d;
  -                nextChar += d;
  -                if (nextChar >= bufferSize) 
  -		    reAllocBuff(0);
  -            }
  +            System.arraycopy(cbuf, off, cb, nextChar, len);
           }
       }
   
  @@ -198,15 +181,11 @@
        */
       public void write(String s, int off, int len) throws IOException {
           synchronized (lock) {
  -            int b = off, t = off + len;
  -            while (b < t) {
  -                int d = min(bufferSize - nextChar, t - b);
  -                s.getChars(b, b + d, cb, nextChar);
  -                b += d;
  -                nextChar += d;
  -                if (nextChar >= bufferSize) 
  -		    reAllocBuff(0);
  -            }
  +	    if (len >= bufferSize - nextChar)
  +	        reAllocBuff(len);
  +
  +            s.getChars(off, off + len, cb, nextChar);
  +	    nextChar += len;
           }
       }
   
  
  
  

Mime
View raw message