commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From joc...@apache.org
Subject svn commit: r735371 - in /commons/proper/fileupload/trunk/src: changes/changes.xml java/org/apache/commons/fileupload/MultipartStream.java
Date Sun, 18 Jan 2009 01:55:17 GMT
Author: jochen
Date: Sat Jan 17 17:55:17 2009
New Revision: 735371

URL: http://svn.apache.org/viewvc?rev=735371&view=rev
Log:
PR: FILEUPLOAD-158
Submitted-By: Stepan Koltsov <yozh@mx1.ru>
Fixed example in Javadocs of MultipartStream.

Modified:
    commons/proper/fileupload/trunk/src/changes/changes.xml
    commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/MultipartStream.java

Modified: commons/proper/fileupload/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/changes/changes.xml?rev=735371&r1=735370&r2=735371&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/changes/changes.xml (original)
+++ commons/proper/fileupload/trunk/src/changes/changes.xml Sat Jan 17 17:55:17 2009
@@ -47,6 +47,10 @@
         Temporary files have not been deleted, if an error
         occurred in FileUploadBase.parseRequest();
       </action>
+      <action dev="jochen" type="fix" issue="FILEUPLOAD-158"
+          due-to="Stepan Koltsov" due-to-email="yozh@mx1.ru">
+        Fixed example in MultipartStream Javadocs.
+      </action>
     </release>
 
     <release version="1.2.1" date="2008-01-18">

Modified: commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/MultipartStream.java
URL: http://svn.apache.org/viewvc/commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/MultipartStream.java?rev=735371&r1=735370&r2=735371&view=diff
==============================================================================
--- commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/MultipartStream.java
(original)
+++ commons/proper/fileupload/trunk/src/java/org/apache/commons/fileupload/MultipartStream.java
Sat Jan 17 17:55:17 2009
@@ -60,24 +60,22 @@
  * <p>Here is an example of usage of this class.<br>
  *
  * <pre>
- *    try {
- *        MultipartStream multipartStream = new MultipartStream(input,
- *                                                              boundary);
- *        boolean nextPart = multipartStream.skipPreamble();
- *        OutputStream output;
- *        while(nextPart) {
- *            header = chunks.readHeader();
- *            // process headers
- *            // create some output stream
- *            multipartStream.readBodyPart(output);
- *            nextPart = multipartStream.readBoundary();
- *        }
- *    } catch(MultipartStream.MalformedStreamException e) {
- *          // the stream failed to follow required syntax
- *    } catch(IOException) {
- *          // a read or write error occurred
- *    }
- *
+ *   try {
+ *     MultipartStream multipartStream = new MultipartStream(input, boundary);
+ *     boolean nextPart = multipartStream.skipPreamble();
+ *     OutputStream output;
+ *     while(nextPart) {
+ *       String header = multipartStream.readHeaders();
+ *       // process headers
+ *       // create some output stream
+ *       multipartStream.readBodyData(output);
+ *       nextPart = multipartStream.readBoundary();
+ *     }
+ *   } catch(MultipartStream.MalformedStreamException e) {
+ *     // the stream failed to follow required syntax
+ *   } catch(IOException e) {
+ *     // a read or write error occurred
+ *   }
  * </pre>
  *
  * @author <a href="mailto:Rafal.Krzewski@e-point.pl">Rafal Krzewski</a>
@@ -1004,70 +1002,4 @@
             return closed;
         }
     }
-
-    // ------------------------------------------------------ Debugging methods
-
-
-    // These are the methods that were used to debug this stuff.
-    /*
-
-    // Dump data.
-    protected void dump()
-    {
-        System.out.println("01234567890");
-        byte[] temp = new byte[buffer.length];
-        for(int i=0; i<buffer.length; i++)
-        {
-            if (buffer[i] == 0x0D || buffer[i] == 0x0A)
-            {
-                temp[i] = 0x21;
-            }
-            else
-            {
-                temp[i] = buffer[i];
-            }
-        }
-        System.out.println(new String(temp));
-        int i;
-        for (i=0; i<head; i++)
-            System.out.print(" ");
-        System.out.println("h");
-        for (i=0; i<tail; i++)
-            System.out.print(" ");
-        System.out.println("t");
-        System.out.flush();
-    }
-
-    // Main routine, for testing purposes only.
-    //
-    // @param args A String[] with the command line arguments.
-    // @throws Exception, a generic exception.
-    public static void main( String[] args )
-        throws Exception
-    {
-        File boundaryFile = new File("boundary.dat");
-        int boundarySize = (int)boundaryFile.length();
-        byte[] boundary = new byte[boundarySize];
-        FileInputStream input = new FileInputStream(boundaryFile);
-        input.read(boundary,0,boundarySize);
-
-        input = new FileInputStream("multipart.dat");
-        MultipartStream chunks = new MultipartStream(input, boundary);
-
-        int i = 0;
-        String header;
-        OutputStream output;
-        boolean nextChunk = chunks.skipPreamble();
-        while (nextChunk)
-        {
-            header = chunks.readHeaders();
-            System.out.println("!"+header+"!");
-            System.out.println("wrote part"+i+".dat");
-            output = new FileOutputStream("part"+(i++)+".dat");
-            chunks.readBodyData(output);
-            nextChunk = chunks.readBoundary();
-        }
-    }
-
-     */
 }



Mime
View raw message