dropped unused variables, decode() method made static
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/fileupload/trunk@1456834 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java b/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java
index 56f1622..4d67044 100644
--- a/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java
+++ b/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java
@@ -225,8 +225,7 @@
if (encoding.equals("B")) {
BASE64_DECODER.decode(encodedData, 0, encodedData.length, out);
} else if (encoding.equals("Q")) { // maybe quoted printable.
- QuotedPrintableDecoder dataEncoder = new QuotedPrintableDecoder();
- dataEncoder.decodeWord(encodedData, 0, encodedData.length, out);
+ QuotedPrintableDecoder.decodeWord(encodedData, 0, encodedData.length, out);
} else {
throw new UnsupportedEncodingException("Unknown RFC 2047 encoding: " + encoding);
}
diff --git a/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java b/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
index 43cb83e..40399be 100644
--- a/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
+++ b/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
@@ -46,64 +46,6 @@
}
/**
- * default number of characters we will write per line.
- */
- private static final int DEFAULT_CHARS_PER_LINE = 76;
-
- /**
- * the output stream we're wrapped around
- */
- protected OutputStream out;
-
- /**
- * the number of bytes written;
- */
- protected int bytesWritten = 0;
-
- /**
- * number of bytes written on the current line
- */
- protected int lineCount = 0;
-
- /**
- * line length we're dealing with
- */
- protected int lineLength;
-
- /**
- * number of deferred whitespace characters in decode mode.
- */
- protected int deferredWhitespace = 0;
-
- /**
- * internal parsed character cache.
- */
- protected int cachedCharacter = -1;
-
- /**
- * indicates whether the last character was a '\r', potentially part of a CRLF sequence.
- */
- protected boolean lastCR = false;
-
- /**
- * remember whether last character was a white space.
- */
- protected boolean lastWhitespace = false;
-
- public QuotedPrintableDecoder() {
- this(null, DEFAULT_CHARS_PER_LINE);
- }
-
- public QuotedPrintableDecoder(OutputStream out) {
- this(out, DEFAULT_CHARS_PER_LINE);
- }
-
- public QuotedPrintableDecoder(OutputStream out, int lineLength) {
- this.out = out;
- this.lineLength = lineLength;
- }
-
- /**
* decode the uuencoded byte data writing it to the given output stream
*
* @param data The array of byte data to decode.
@@ -114,10 +56,7 @@
* @return the number of bytes produced.
* @exception IOException
*/
- public int decodeWord(byte[] data, int off, int length, OutputStream out) throws IOException {
- // make sure we're writing to the correct stream
- this.out = out;
-
+ public static int decodeWord(byte[] data, int off, int length, OutputStream out) throws IOException {
int endOffset = off + length;
int bytesWritten = 0;