You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2013/03/15 10:36:36 UTC

svn commit: r1456834 - in /commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime: MimeUtility.java QuotedPrintableDecoder.java

Author: simonetripodi
Date: Fri Mar 15 09:36:35 2013
New Revision: 1456834

URL: http://svn.apache.org/r1456834
Log:
dropped unused variables, decode() method made static

Modified:
    commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java
    commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java

Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java?rev=1456834&r1=1456833&r2=1456834&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java (original)
+++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/MimeUtility.java Fri Mar 15 09:36:35 2013
@@ -225,8 +225,7 @@ public final class MimeUtility {
             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);
             }

Modified: commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java?rev=1456834&r1=1456833&r2=1456834&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java (original)
+++ commons/proper/fileupload/trunk/src/main/java/org/apache/commons/fileupload/util/mime/QuotedPrintableDecoder.java Fri Mar 15 09:36:35 2013
@@ -46,64 +46,6 @@ final class QuotedPrintableDecoder {
     }
 
     /**
-     * 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 @@ final class QuotedPrintableDecoder {
      * @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;