Author: remy.maucherat(a)jboss.com
Date: 2008-03-26 23:03:37 -0400 (Wed, 26 Mar 2008)
New Revision: 556
Modified:
trunk/java/org/apache/catalina/connector/InputBuffer.java
Log:
- IB no longer uses the overflow mechanism, so cleanup the code.
Modified: trunk/java/org/apache/catalina/connector/InputBuffer.java
===================================================================
--- trunk/java/org/apache/catalina/connector/InputBuffer.java 2008-03-27 00:42:29 UTC (rev
555)
+++ trunk/java/org/apache/catalina/connector/InputBuffer.java 2008-03-27 03:03:37 UTC (rev
556)
@@ -41,8 +41,7 @@
* @author Remy Maucherat
*/
public class InputBuffer extends Reader
- implements ByteChunk.ByteInputChannel, CharChunk.CharInputChannel,
- CharChunk.CharOutputChannel {
+ implements ByteChunk.ByteInputChannel, CharChunk.CharInputChannel {
// -------------------------------------------------------------- Constants
@@ -81,30 +80,12 @@
/**
- * Number of bytes read.
- */
- private int bytesRead = 0;
-
-
- /**
- * Number of chars read.
- */
- private int charsRead = 0;
-
-
- /**
* Flag which indicates if the input buffer is closed.
*/
private boolean closed = false;
/**
- * Byte chunk used to input bytes.
- */
- private ByteChunk inputChunk = new ByteChunk();
-
-
- /**
* Encoding to use.
*/
private String enc;
@@ -119,7 +100,8 @@
/**
* List of encoders.
*/
- protected HashMap encoders = new HashMap();
+ protected HashMap<String, B2CConverter> encoders =
+ new HashMap<String, B2CConverter>();
/**
@@ -181,7 +163,6 @@
cb.setLimit(size);
cb.setOptimizedWrite(false);
cb.setCharInputChannel(this);
- cb.setCharOutputChannel(this);
}
@@ -218,8 +199,6 @@
public void recycle() {
state = INITIAL_STATE;
- bytesRead = 0;
- charsRead = 0;
// If usage of mark made the buffer too big, reallocate it
if (cb.getChars().length > size) {
@@ -227,7 +206,6 @@
cb.setLimit(size);
cb.setOptimizedWrite(false);
cb.setCharInputChannel(this);
- cb.setCharOutputChannel(this);
} else {
cb.recycle();
}
@@ -356,20 +334,6 @@
// ------------------------------------------------- Chars Handling Methods
- /**
- * Since the converter will use append, it is possible to get chars to
- * be removed from the buffer for "writing". Since the chars have already
- * been read before, they are ignored. If a mark was set, then the
- * mark is lost.
- */
- public void realWriteChars(char c[], int off, int len)
- throws IOException {
- markPos = -1;
- cb.setOffset(0);
- cb.setEnd(0);
- }
-
-
public void setEncoding(String s) {
enc = s;
}
@@ -527,7 +491,7 @@
gotEnc = true;
if (enc == null)
enc = DEFAULT_ENCODING;
- conv = (B2CConverter) encoders.get(enc);
+ conv = encoders.get(enc);
if (conv == null) {
if (SecurityUtil.isPackageProtectionEnabled()){
try{
Show replies by date