You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by ma...@apache.org on 2008/03/30 22:52:23 UTC

svn commit: r642814 - /tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java

Author: markt
Date: Sun Mar 30 13:52:21 2008
New Revision: 642814

URL: http://svn.apache.org/viewvc?rev=642814&view=rev
Log:
Tab police. Tabs -> 8 spaces. No functional change.

Modified:
    tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java?rev=642814&r1=642813&r2=642814&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/B2CConverter.java Sun Mar 30 13:52:21 2008
@@ -50,10 +50,10 @@
     /** Create a converter, with bytes going to a byte buffer
      */
     public B2CConverter(String encoding)
-	throws IOException
+        throws IOException
     {
-	this.encoding=encoding;
-	reset();
+        this.encoding=encoding;
+        reset();
     }
 
     
@@ -61,7 +61,7 @@
      *  The encoding remain in effect, the internal buffers remain allocated.
      */
     public  void recycle() {
-	conv.recycle();
+        conv.recycle();
     }
 
     static final int BUFFER_SIZE=8192;
@@ -71,10 +71,10 @@
      * @deprecated
      */
     public  void convert( ByteChunk bb, CharChunk cb )
-	throws IOException
+        throws IOException
     {
-	// Set the ByteChunk as input to the Intermediate reader
-	convert(bb, cb, cb.getBuffer().length - cb.getEnd());
+        // Set the ByteChunk as input to the Intermediate reader
+        convert(bb, cb, cb.getBuffer().length - cb.getEnd());
     }
 
     public void convert( ByteChunk bb, CharChunk cb, int limit) 
@@ -85,42 +85,42 @@
     }
 
     private void convert(CharChunk cb, int limit)
-	throws IOException
+        throws IOException
     {
-	try {
-	    // read from the reader
+        try {
+            // read from the reader
             int count = 0;
-	    while( limit > 0 ) { // conv.ready() ) {
+            while( limit > 0 ) { // conv.ready() ) {
                 int size = limit < BUFFER_SIZE ? limit : BUFFER_SIZE;
-		int cnt=conv.read( result, 0, size );
-		if( cnt <= 0 ) {
-		    // End of stream ! - we may be in a bad state
-		    if( debug>0)
-			log( "EOF" );
-		    //		    reset();
-		    return;
-		}
-		if( debug > 1 )
-		    log("Converted: " + new String( result, 0, cnt ));
+                int cnt=conv.read( result, 0, size );
+                if( cnt <= 0 ) {
+                    // End of stream ! - we may be in a bad state
+                    if( debug>0)
+                        log( "EOF" );
+                    //                    reset();
+                    return;
+                }
+                if( debug > 1 )
+                    log("Converted: " + new String( result, 0, cnt ));
 
-		// XXX go directly
-		cb.append( result, 0, cnt );
+                // XXX go directly
+                cb.append( result, 0, cnt );
                 limit -= cnt;
-	    }
-	} catch( IOException ex) {
-	    if( debug>0)
-		log( "Reseting the converter " + ex.toString() );
-	    reset();
-	    throw ex;
-	}
+            }
+        } catch( IOException ex) {
+            if( debug>0)
+                log( "Reseting the converter " + ex.toString() );
+            reset();
+            throw ex;
+        }
     }
 
     public void reset()
-	throws IOException
+        throws IOException
     {
-	// destroy the reader/iis
-	iis=new IntermediateInputStream();
-	conv=new ReadConvertor( iis, encoding );
+        // destroy the reader/iis
+        iis=new IntermediateInputStream();
+        conv=new ReadConvertor( iis, encoding );
     }
 
     private final int debug=0;
@@ -141,45 +141,45 @@
 
 
     private  static String decodeString(ByteChunk mb, String enc)
-	throws IOException
+        throws IOException
     {
-	byte buff=mb.getBuffer();
-	int start=mb.getStart();
-	int end=mb.getEnd();
-	if( useNewString ) {
-	    if( enc==null) enc="UTF8";
-	    return new String( buff, start, end-start, enc );
-	}
-	B2CConverter b2c=null;
-	if( useSpecialDecoders &&
-	    (enc==null || "UTF8".equalsIgnoreCase(enc))) {
-	    if( utfD==null ) utfD=new UTF8Decoder();
-	    b2c=utfD;
-	}
-	if(decoders == null ) decoders=new Hashtable();
-	if( enc==null ) enc="UTF8";
-	b2c=(B2CConverter)decoders.get( enc );
-	if( b2c==null ) {
-	    if( useSpecialDecoders ) {
-		if( "UTF8".equalsIgnoreCase( enc ) ) {
-		    b2c=new UTF8Decoder();
-		}
-	    }
-	    if( b2c==null )
-		b2c=new B2CConverter( enc );
-	    decoders.put( enc, b2c );
-	}
-	if( conversionBuf==null ) conversionBuf=new CharChunk(1024);
-
-	try {
-	    conversionBuf.recycle();
-	    b2c.convert( this, conversionBuf );
-	    //System.out.println("XXX 1 " + conversionBuf );
-	    return conversionBuf.toString();
-	} catch( IOException ex ) {
-	    ex.printStackTrace();
-	    return null;
-	}
+        byte buff=mb.getBuffer();
+        int start=mb.getStart();
+        int end=mb.getEnd();
+        if( useNewString ) {
+            if( enc==null) enc="UTF8";
+            return new String( buff, start, end-start, enc );
+        }
+        B2CConverter b2c=null;
+        if( useSpecialDecoders &&
+            (enc==null || "UTF8".equalsIgnoreCase(enc))) {
+            if( utfD==null ) utfD=new UTF8Decoder();
+            b2c=utfD;
+        }
+        if(decoders == null ) decoders=new Hashtable();
+        if( enc==null ) enc="UTF8";
+        b2c=(B2CConverter)decoders.get( enc );
+        if( b2c==null ) {
+            if( useSpecialDecoders ) {
+                if( "UTF8".equalsIgnoreCase( enc ) ) {
+                    b2c=new UTF8Decoder();
+                }
+            }
+            if( b2c==null )
+                b2c=new B2CConverter( enc );
+            decoders.put( enc, b2c );
+        }
+        if( conversionBuf==null ) conversionBuf=new CharChunk(1024);
+
+        try {
+            conversionBuf.recycle();
+            b2c.convert( this, conversionBuf );
+            //System.out.println("XXX 1 " + conversionBuf );
+            return conversionBuf.toString();
+        } catch( IOException ex ) {
+            ex.printStackTrace();
+            return null;
+        }
     }
 
     */
@@ -201,24 +201,24 @@
     /** Create a converter.
      */
     public ReadConvertor( IntermediateInputStream in, String enc )
-	throws UnsupportedEncodingException
+        throws UnsupportedEncodingException
     {
-	super( in, enc );
-	iis=in;
+        super( in, enc );
+        iis=in;
     }
     
     /** Overriden - will do nothing but reset internal state.
      */
     public  final void close() throws IOException {
-	// NOTHING
-	// Calling super.close() would reset out and cb.
+        // NOTHING
+        // Calling super.close() would reset out and cb.
     }
     
     public  final int read(char cbuf[], int off, int len)
-	throws IOException
+        throws IOException
     {
-	// will do the conversion and call write on the output stream
-	return super.read( cbuf, off, len );
+        // will do the conversion and call write on the output stream
+        return super.read( cbuf, off, len );
     }
     
     /** Reset the buffer
@@ -241,16 +241,16 @@
     }
     
     public  final void close() throws IOException {
-	// shouldn't be called - we filter it out in writer
-	throw new IOException("close() called - shouldn't happen ");
+        // shouldn't be called - we filter it out in writer
+        throw new IOException("close() called - shouldn't happen ");
     }
     
     public  final  int read(byte cbuf[], int off, int len) throws IOException {
-	return bc.substract(cbuf, off, len);
+        return bc.substract(cbuf, off, len);
     }
     
     public  final int read() throws IOException {
-	return bc.substract();
+        return bc.substract();
     }
 
     // -------------------- Internal methods --------------------



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