You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2004/07/15 16:35:39 UTC

cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf MessageBytes.java CharChunk.java

remm        2004/07/15 07:35:39

  Modified:    util/java/org/apache/tomcat/util/buf MessageBytes.java
                        CharChunk.java
  Log:
  - Implement MB.toBytes.
  - Tweak toChars and toBytes, as I think they should change the type of the MB.
  
  Revision  Changes    Path
  1.15      +8 -2      jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java
  
  Index: MessageBytes.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/MessageBytes.java,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- MessageBytes.java	28 Apr 2004 22:04:10 -0000	1.14
  +++ MessageBytes.java	15 Jul 2004 14:35:39 -0000	1.15
  @@ -229,13 +229,20 @@
       /** Unimplemented yet. Do a char->byte conversion.
        */
       public void toBytes() {
  -	// XXX todo - not used yet
  +        type=T_BYTES;
  +        if( ! byteC.isNull() ) {
  +            return;
  +        }
  +        toString();
  +        byte bb[] = strValue.getBytes();
  +        byteC.setBytes(bb, 0, bb.length);
       }
   
       /** Convert to char[] and fill the CharChunk.
        *  XXX Not optimized - it converts to String first.
        */
       public void toChars() {
  +        type=T_CHARS;
   	if( ! charC.isNull() ) {
   	    return;
   	}
  @@ -243,7 +250,6 @@
   	toString();
   	char cc[]=strValue.toCharArray();
   	charC.setChars(cc, 0, cc.length);
  -	type=T_CHARS;
       }
       
   
  
  
  
  1.14      +6 -0      jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java
  
  Index: CharChunk.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- CharChunk.java	8 Mar 2004 23:46:37 -0000	1.13
  +++ CharChunk.java	15 Jul 2004 14:35:39 -0000	1.14
  @@ -341,6 +341,12 @@
   
       /** Append a string to the buffer
        */
  +    public void append(String s) throws IOException {
  +        append(s, 0, s.length());
  +    }
  +    
  +    /** Append a string to the buffer
  +     */
       public void append(String s, int off, int len) throws IOException {
   	if (s==null) return;
   	
  
  
  

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