commons-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r991782 [43/46] - in /websites/production/commons/content/proper/commons-fileupload: ./ apidocs/ apidocs/org/apache/commons/fileupload/ apidocs/org/apache/commons/fileupload/class-use/ apidocs/org/apache/commons/fileupload/disk/ apidocs/org...
Date Fri, 01 Jul 2016 05:48:38 GMT
Modified: websites/production/commons/content/proper/commons-fileupload/xref/org/apache/commons/fileupload/MultipartStream.html
==============================================================================
--- websites/production/commons/content/proper/commons-fileupload/xref/org/apache/commons/fileupload/MultipartStream.html (original)
+++ websites/production/commons/content/proper/commons-fileupload/xref/org/apache/commons/fileupload/MultipartStream.html Fri Jul  1 05:48:35 2016
@@ -89,7 +89,7 @@
 <a class="jxr_linenumber" name="L81" href="#L81">81</a>  <em class="jxr_javadoccomment"> *   }</em>
 <a class="jxr_linenumber" name="L82" href="#L82">82</a>  <em class="jxr_javadoccomment"> * &lt;/pre&gt;</em>
 <a class="jxr_linenumber" name="L83" href="#L83">83</a>  <em class="jxr_javadoccomment"> *</em>
-<a class="jxr_linenumber" name="L84" href="#L84">84</a>  <em class="jxr_javadoccomment"> * @version $Id: MultipartStream.java 1745065 2016-05-22 14:56:37Z britter $</em>
+<a class="jxr_linenumber" name="L84" href="#L84">84</a>  <em class="jxr_javadoccomment"> * @version $Id: MultipartStream.java 1743480 2016-05-12 08:13:59Z jochen $</em>
 <a class="jxr_linenumber" name="L85" href="#L85">85</a>  <em class="jxr_javadoccomment"> */</em>
 <a class="jxr_linenumber" name="L86" href="#L86">86</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">MultipartStream</a> {
 <a class="jxr_linenumber" name="L87" href="#L87">87</a>  
@@ -230,12 +230,12 @@
 <a class="jxr_linenumber" name="L222" href="#L222">222</a> <em class="jxr_javadoccomment">     * The amount of data, in bytes, that must be kept in the buffer in order</em>
 <a class="jxr_linenumber" name="L223" href="#L223">223</a> <em class="jxr_javadoccomment">     * to detect delimiters reliably.</em>
 <a class="jxr_linenumber" name="L224" href="#L224">224</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L225" href="#L225">225</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> keepRegion;
+<a class="jxr_linenumber" name="L225" href="#L225">225</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> keepRegion;
 <a class="jxr_linenumber" name="L226" href="#L226">226</a> 
 <a class="jxr_linenumber" name="L227" href="#L227">227</a>     <em class="jxr_javadoccomment">/**</em>
 <a class="jxr_linenumber" name="L228" href="#L228">228</a> <em class="jxr_javadoccomment">     * The byte sequence that partitions the stream.</em>
 <a class="jxr_linenumber" name="L229" href="#L229">229</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L230" href="#L230">230</a>     <strong class="jxr_keyword">private</strong> byte[] boundary;
+<a class="jxr_linenumber" name="L230" href="#L230">230</a>     <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">final</strong> byte[] boundary;
 <a class="jxr_linenumber" name="L231" href="#L231">231</a> 
 <a class="jxr_linenumber" name="L232" href="#L232">232</a>     <em class="jxr_javadoccomment">/**</em>
 <a class="jxr_linenumber" name="L233" href="#L233">233</a> <em class="jxr_javadoccomment">     * The length of the buffer used for processing the request.</em>
@@ -342,7 +342,7 @@
 <a class="jxr_linenumber" name="L334" href="#L334">334</a>         }
 <a class="jxr_linenumber" name="L335" href="#L335">335</a> 
 <a class="jxr_linenumber" name="L336" href="#L336">336</a>         <strong class="jxr_keyword">this</strong>.input = input;
-<a class="jxr_linenumber" name="L337" href="#L337">337</a>         <strong class="jxr_keyword">this</strong>.bufSize = Math.max(bufSize, boundaryLength * 2);
+<a class="jxr_linenumber" name="L337" href="#L337">337</a>         <strong class="jxr_keyword">this</strong>.bufSize = Math.max(bufSize, boundaryLength*2);
 <a class="jxr_linenumber" name="L338" href="#L338">338</a>         <strong class="jxr_keyword">this</strong>.buffer = <strong class="jxr_keyword">new</strong> byte[<strong class="jxr_keyword">this</strong>.bufSize];
 <a class="jxr_linenumber" name="L339" href="#L339">339</a>         <strong class="jxr_keyword">this</strong>.notifier = pNotifier;
 <a class="jxr_linenumber" name="L340" href="#L340">340</a> 
@@ -597,447 +597,446 @@
 <a class="jxr_linenumber" name="L589" href="#L589">589</a> <em class="jxr_javadoccomment">     */</em>
 <a class="jxr_linenumber" name="L590" href="#L590">590</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> readBodyData(OutputStream output)
 <a class="jxr_linenumber" name="L591" href="#L591">591</a>             <strong class="jxr_keyword">throws</strong> MalformedStreamException, IOException {
-<a class="jxr_linenumber" name="L592" href="#L592">592</a>         <strong class="jxr_keyword">final</strong> InputStream istream = newInputStream();
-<a class="jxr_linenumber" name="L593" href="#L593">593</a>         <strong class="jxr_keyword">return</strong> (<strong class="jxr_keyword">int</strong>) Streams.copy(istream, output, false);
-<a class="jxr_linenumber" name="L594" href="#L594">594</a>     }
-<a class="jxr_linenumber" name="L595" href="#L595">595</a> 
-<a class="jxr_linenumber" name="L596" href="#L596">596</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L597" href="#L597">597</a> <em class="jxr_javadoccomment">     * Creates a new {@link ItemInputStream}.</em>
-<a class="jxr_linenumber" name="L598" href="#L598">598</a> <em class="jxr_javadoccomment">     * @return A new instance of {@link ItemInputStream}.</em>
-<a class="jxr_linenumber" name="L599" href="#L599">599</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L600" href="#L600">600</a>     <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">ItemInputStream</a> newInputStream() {
-<a class="jxr_linenumber" name="L601" href="#L601">601</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">ItemInputStream</a>();
-<a class="jxr_linenumber" name="L602" href="#L602">602</a>     }
-<a class="jxr_linenumber" name="L603" href="#L603">603</a> 
-<a class="jxr_linenumber" name="L604" href="#L604">604</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L605" href="#L605">605</a> <em class="jxr_javadoccomment">     * &lt;p&gt; Reads &lt;code&gt;body-data&lt;/code&gt; from the current</em>
-<a class="jxr_linenumber" name="L606" href="#L606">606</a> <em class="jxr_javadoccomment">     * &lt;code&gt;encapsulation&lt;/code&gt; and discards it.</em>
-<a class="jxr_linenumber" name="L607" href="#L607">607</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L608" href="#L608">608</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Use this method to skip encapsulations you don't need or don't</em>
-<a class="jxr_linenumber" name="L609" href="#L609">609</a> <em class="jxr_javadoccomment">     * understand.</em>
-<a class="jxr_linenumber" name="L610" href="#L610">610</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L611" href="#L611">611</a> <em class="jxr_javadoccomment">     * @return The amount of data discarded.</em>
-<a class="jxr_linenumber" name="L612" href="#L612">612</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L613" href="#L613">613</a> <em class="jxr_javadoccomment">     * @throws MalformedStreamException if the stream ends unexpectedly.</em>
-<a class="jxr_linenumber" name="L614" href="#L614">614</a> <em class="jxr_javadoccomment">     * @throws IOException              if an i/o error occurs.</em>
-<a class="jxr_linenumber" name="L615" href="#L615">615</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L616" href="#L616">616</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> discardBodyData() <strong class="jxr_keyword">throws</strong> MalformedStreamException, IOException {
-<a class="jxr_linenumber" name="L617" href="#L617">617</a>         <strong class="jxr_keyword">return</strong> readBodyData(<strong class="jxr_keyword">null</strong>);
-<a class="jxr_linenumber" name="L618" href="#L618">618</a>     }
-<a class="jxr_linenumber" name="L619" href="#L619">619</a> 
-<a class="jxr_linenumber" name="L620" href="#L620">620</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L621" href="#L621">621</a> <em class="jxr_javadoccomment">     * Finds the beginning of the first &lt;code&gt;encapsulation&lt;/code&gt;.</em>
-<a class="jxr_linenumber" name="L622" href="#L622">622</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L623" href="#L623">623</a> <em class="jxr_javadoccomment">     * @return &lt;code&gt;true&lt;/code&gt; if an &lt;code&gt;encapsulation&lt;/code&gt; was found in</em>
-<a class="jxr_linenumber" name="L624" href="#L624">624</a> <em class="jxr_javadoccomment">     *         the stream.</em>
-<a class="jxr_linenumber" name="L625" href="#L625">625</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L626" href="#L626">626</a> <em class="jxr_javadoccomment">     * @throws IOException if an i/o error occurs.</em>
-<a class="jxr_linenumber" name="L627" href="#L627">627</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L628" href="#L628">628</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> skipPreamble() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="L629" href="#L629">629</a>         <em class="jxr_comment">// First delimiter may be not preceeded with a CRLF.</em>
-<a class="jxr_linenumber" name="L630" href="#L630">630</a>         System.arraycopy(boundary, 2, boundary, 0, boundary.length - 2);
-<a class="jxr_linenumber" name="L631" href="#L631">631</a>         boundaryLength = boundary.length - 2;
-<a class="jxr_linenumber" name="L632" href="#L632">632</a>         <strong class="jxr_keyword">try</strong> {
-<a class="jxr_linenumber" name="L633" href="#L633">633</a>             <em class="jxr_comment">// Discard all data up to the delimiter.</em>
-<a class="jxr_linenumber" name="L634" href="#L634">634</a>             discardBodyData();
-<a class="jxr_linenumber" name="L635" href="#L635">635</a> 
-<a class="jxr_linenumber" name="L636" href="#L636">636</a>             <em class="jxr_comment">// Read boundary - if succeeded, the stream contains an</em>
-<a class="jxr_linenumber" name="L637" href="#L637">637</a>             <em class="jxr_comment">// encapsulation.</em>
-<a class="jxr_linenumber" name="L638" href="#L638">638</a>             <strong class="jxr_keyword">return</strong> readBoundary();
-<a class="jxr_linenumber" name="L639" href="#L639">639</a>         } <strong class="jxr_keyword">catch</strong> (MalformedStreamException e) {
-<a class="jxr_linenumber" name="L640" href="#L640">640</a>             <strong class="jxr_keyword">return</strong> false;
-<a class="jxr_linenumber" name="L641" href="#L641">641</a>         } <strong class="jxr_keyword">finally</strong> {
-<a class="jxr_linenumber" name="L642" href="#L642">642</a>             <em class="jxr_comment">// Restore delimiter.</em>
-<a class="jxr_linenumber" name="L643" href="#L643">643</a>             System.arraycopy(boundary, 0, boundary, 2, boundary.length - 2);
-<a class="jxr_linenumber" name="L644" href="#L644">644</a>             boundaryLength = boundary.length;
-<a class="jxr_linenumber" name="L645" href="#L645">645</a>             boundary[0] = CR;
-<a class="jxr_linenumber" name="L646" href="#L646">646</a>             boundary[1] = LF;
-<a class="jxr_linenumber" name="L647" href="#L647">647</a>         }
-<a class="jxr_linenumber" name="L648" href="#L648">648</a>     }
-<a class="jxr_linenumber" name="L649" href="#L649">649</a> 
-<a class="jxr_linenumber" name="L650" href="#L650">650</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L651" href="#L651">651</a> <em class="jxr_javadoccomment">     * Compares &lt;code&gt;count&lt;/code&gt; first bytes in the arrays</em>
-<a class="jxr_linenumber" name="L652" href="#L652">652</a> <em class="jxr_javadoccomment">     * &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;.</em>
-<a class="jxr_linenumber" name="L653" href="#L653">653</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L654" href="#L654">654</a> <em class="jxr_javadoccomment">     * @param a     The first array to compare.</em>
-<a class="jxr_linenumber" name="L655" href="#L655">655</a> <em class="jxr_javadoccomment">     * @param b     The second array to compare.</em>
-<a class="jxr_linenumber" name="L656" href="#L656">656</a> <em class="jxr_javadoccomment">     * @param count How many bytes should be compared.</em>
-<a class="jxr_linenumber" name="L657" href="#L657">657</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L658" href="#L658">658</a> <em class="jxr_javadoccomment">     * @return &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;count&lt;/code&gt; first bytes in arrays</em>
-<a class="jxr_linenumber" name="L659" href="#L659">659</a> <em class="jxr_javadoccomment">     *         &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; are equal.</em>
-<a class="jxr_linenumber" name="L660" href="#L660">660</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L661" href="#L661">661</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">boolean</strong> arrayequals(byte[] a,
-<a class="jxr_linenumber" name="L662" href="#L662">662</a>             byte[] b,
-<a class="jxr_linenumber" name="L663" href="#L663">663</a>             <strong class="jxr_keyword">int</strong> count) {
-<a class="jxr_linenumber" name="L664" href="#L664">664</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; count; i++) {
-<a class="jxr_linenumber" name="L665" href="#L665">665</a>             <strong class="jxr_keyword">if</strong> (a[i] != b[i]) {
-<a class="jxr_linenumber" name="L666" href="#L666">666</a>                 <strong class="jxr_keyword">return</strong> false;
-<a class="jxr_linenumber" name="L667" href="#L667">667</a>             }
-<a class="jxr_linenumber" name="L668" href="#L668">668</a>         }
-<a class="jxr_linenumber" name="L669" href="#L669">669</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="L670" href="#L670">670</a>     }
-<a class="jxr_linenumber" name="L671" href="#L671">671</a> 
-<a class="jxr_linenumber" name="L672" href="#L672">672</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L673" href="#L673">673</a> <em class="jxr_javadoccomment">     * Searches for a byte of specified value in the &lt;code&gt;buffer&lt;/code&gt;,</em>
-<a class="jxr_linenumber" name="L674" href="#L674">674</a> <em class="jxr_javadoccomment">     * starting at the specified &lt;code&gt;position&lt;/code&gt;.</em>
-<a class="jxr_linenumber" name="L675" href="#L675">675</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L676" href="#L676">676</a> <em class="jxr_javadoccomment">     * @param value The value to find.</em>
-<a class="jxr_linenumber" name="L677" href="#L677">677</a> <em class="jxr_javadoccomment">     * @param pos   The starting position for searching.</em>
-<a class="jxr_linenumber" name="L678" href="#L678">678</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L679" href="#L679">679</a> <em class="jxr_javadoccomment">     * @return The position of byte found, counting from beginning of the</em>
-<a class="jxr_linenumber" name="L680" href="#L680">680</a> <em class="jxr_javadoccomment">     *         &lt;code&gt;buffer&lt;/code&gt;, or &lt;code&gt;-1&lt;/code&gt; if not found.</em>
-<a class="jxr_linenumber" name="L681" href="#L681">681</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L682" href="#L682">682</a>     <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">int</strong> findByte(byte value,
-<a class="jxr_linenumber" name="L683" href="#L683">683</a>             <strong class="jxr_keyword">int</strong> pos) {
-<a class="jxr_linenumber" name="L684" href="#L684">684</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = pos; i &lt; tail; i++) {
-<a class="jxr_linenumber" name="L685" href="#L685">685</a>             <strong class="jxr_keyword">if</strong> (buffer[i] == value) {
-<a class="jxr_linenumber" name="L686" href="#L686">686</a>                 <strong class="jxr_keyword">return</strong> i;
-<a class="jxr_linenumber" name="L687" href="#L687">687</a>             }
-<a class="jxr_linenumber" name="L688" href="#L688">688</a>         }
-<a class="jxr_linenumber" name="L689" href="#L689">689</a> 
-<a class="jxr_linenumber" name="L690" href="#L690">690</a>         <strong class="jxr_keyword">return</strong> -1;
-<a class="jxr_linenumber" name="L691" href="#L691">691</a>     }
-<a class="jxr_linenumber" name="L692" href="#L692">692</a> 
-<a class="jxr_linenumber" name="L693" href="#L693">693</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L694" href="#L694">694</a> <em class="jxr_javadoccomment">     * Searches for the &lt;code&gt;boundary&lt;/code&gt; in the &lt;code&gt;buffer&lt;/code&gt;</em>
-<a class="jxr_linenumber" name="L695" href="#L695">695</a> <em class="jxr_javadoccomment">     * region delimited by &lt;code&gt;head&lt;/code&gt; and &lt;code&gt;tail&lt;/code&gt;.</em>
-<a class="jxr_linenumber" name="L696" href="#L696">696</a> <em class="jxr_javadoccomment">     *</em>
-<a class="jxr_linenumber" name="L697" href="#L697">697</a> <em class="jxr_javadoccomment">     * @return The position of the boundary found, counting from the</em>
-<a class="jxr_linenumber" name="L698" href="#L698">698</a> <em class="jxr_javadoccomment">     *         beginning of the &lt;code&gt;buffer&lt;/code&gt;, or &lt;code&gt;-1&lt;/code&gt; if</em>
-<a class="jxr_linenumber" name="L699" href="#L699">699</a> <em class="jxr_javadoccomment">     *         not found.</em>
-<a class="jxr_linenumber" name="L700" href="#L700">700</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L701" href="#L701">701</a>     <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">int</strong> findSeparator() {
-<a class="jxr_linenumber" name="L702" href="#L702">702</a>         <strong class="jxr_keyword">int</strong> first;
-<a class="jxr_linenumber" name="L703" href="#L703">703</a>         <strong class="jxr_keyword">int</strong> match = 0;
-<a class="jxr_linenumber" name="L704" href="#L704">704</a>         <strong class="jxr_keyword">int</strong> maxpos = tail - boundaryLength;
-<a class="jxr_linenumber" name="L705" href="#L705">705</a>         <strong class="jxr_keyword">for</strong> (first = head; first &lt;= maxpos &amp;&amp; match != boundaryLength; first++) {
-<a class="jxr_linenumber" name="L706" href="#L706">706</a>             first = findByte(boundary[0], first);
-<a class="jxr_linenumber" name="L707" href="#L707">707</a>             <strong class="jxr_keyword">if</strong> (first == -1 || first &gt; maxpos) {
-<a class="jxr_linenumber" name="L708" href="#L708">708</a>                 <strong class="jxr_keyword">return</strong> -1;
-<a class="jxr_linenumber" name="L709" href="#L709">709</a>             }
-<a class="jxr_linenumber" name="L710" href="#L710">710</a>             <strong class="jxr_keyword">for</strong> (match = 1; match &lt; boundaryLength; match++) {
-<a class="jxr_linenumber" name="L711" href="#L711">711</a>                 <strong class="jxr_keyword">if</strong> (buffer[first + match] != boundary[match]) {
-<a class="jxr_linenumber" name="L712" href="#L712">712</a>                     <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L713" href="#L713">713</a>                 }
-<a class="jxr_linenumber" name="L714" href="#L714">714</a>             }
-<a class="jxr_linenumber" name="L715" href="#L715">715</a>         }
-<a class="jxr_linenumber" name="L716" href="#L716">716</a>         <strong class="jxr_keyword">if</strong> (match == boundaryLength) {
-<a class="jxr_linenumber" name="L717" href="#L717">717</a>             <strong class="jxr_keyword">return</strong> first - 1;
-<a class="jxr_linenumber" name="L718" href="#L718">718</a>         }
-<a class="jxr_linenumber" name="L719" href="#L719">719</a>         <strong class="jxr_keyword">return</strong> -1;
-<a class="jxr_linenumber" name="L720" href="#L720">720</a>     }
-<a class="jxr_linenumber" name="L721" href="#L721">721</a> 
-<a class="jxr_linenumber" name="L722" href="#L722">722</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L723" href="#L723">723</a> <em class="jxr_javadoccomment">     * Thrown to indicate that the input stream fails to follow the</em>
-<a class="jxr_linenumber" name="L724" href="#L724">724</a> <em class="jxr_javadoccomment">     * required syntax.</em>
-<a class="jxr_linenumber" name="L725" href="#L725">725</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L726" href="#L726">726</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">MalformedStreamException</a> <strong class="jxr_keyword">extends</strong> IOException {
-<a class="jxr_linenumber" name="L727" href="#L727">727</a> 
-<a class="jxr_linenumber" name="L728" href="#L728">728</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L729" href="#L729">729</a> <em class="jxr_javadoccomment">         * The UID to use when serializing this instance.</em>
-<a class="jxr_linenumber" name="L730" href="#L730">730</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L731" href="#L731">731</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> serialVersionUID = 6466926458059796677L;
-<a class="jxr_linenumber" name="L732" href="#L732">732</a> 
-<a class="jxr_linenumber" name="L733" href="#L733">733</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L734" href="#L734">734</a> <em class="jxr_javadoccomment">         * Constructs a &lt;code&gt;MalformedStreamException&lt;/code&gt; with no</em>
-<a class="jxr_linenumber" name="L735" href="#L735">735</a> <em class="jxr_javadoccomment">         * detail message.</em>
-<a class="jxr_linenumber" name="L736" href="#L736">736</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L737" href="#L737">737</a>         <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">MalformedStreamException</a>() {
-<a class="jxr_linenumber" name="L738" href="#L738">738</a>             <strong class="jxr_keyword">super</strong>();
-<a class="jxr_linenumber" name="L739" href="#L739">739</a>         }
-<a class="jxr_linenumber" name="L740" href="#L740">740</a> 
-<a class="jxr_linenumber" name="L741" href="#L741">741</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L742" href="#L742">742</a> <em class="jxr_javadoccomment">         * Constructs an &lt;code&gt;MalformedStreamException&lt;/code&gt; with</em>
-<a class="jxr_linenumber" name="L743" href="#L743">743</a> <em class="jxr_javadoccomment">         * the specified detail message.</em>
-<a class="jxr_linenumber" name="L744" href="#L744">744</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L745" href="#L745">745</a> <em class="jxr_javadoccomment">         * @param message The detail message.</em>
-<a class="jxr_linenumber" name="L746" href="#L746">746</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L747" href="#L747">747</a>         <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">MalformedStreamException</a>(String message) {
-<a class="jxr_linenumber" name="L748" href="#L748">748</a>             <strong class="jxr_keyword">super</strong>(message);
-<a class="jxr_linenumber" name="L749" href="#L749">749</a>         }
-<a class="jxr_linenumber" name="L750" href="#L750">750</a> 
-<a class="jxr_linenumber" name="L751" href="#L751">751</a>     }
-<a class="jxr_linenumber" name="L752" href="#L752">752</a> 
-<a class="jxr_linenumber" name="L753" href="#L753">753</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L754" href="#L754">754</a> <em class="jxr_javadoccomment">     * Thrown upon attempt of setting an invalid boundary token.</em>
-<a class="jxr_linenumber" name="L755" href="#L755">755</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L756" href="#L756">756</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">IllegalBoundaryException</a> <strong class="jxr_keyword">extends</strong> IOException {
-<a class="jxr_linenumber" name="L757" href="#L757">757</a> 
-<a class="jxr_linenumber" name="L758" href="#L758">758</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L759" href="#L759">759</a> <em class="jxr_javadoccomment">         * The UID to use when serializing this instance.</em>
-<a class="jxr_linenumber" name="L760" href="#L760">760</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L761" href="#L761">761</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> serialVersionUID = -161533165102632918L;
-<a class="jxr_linenumber" name="L762" href="#L762">762</a> 
-<a class="jxr_linenumber" name="L763" href="#L763">763</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L764" href="#L764">764</a> <em class="jxr_javadoccomment">         * Constructs an &lt;code&gt;IllegalBoundaryException&lt;/code&gt; with no</em>
-<a class="jxr_linenumber" name="L765" href="#L765">765</a> <em class="jxr_javadoccomment">         * detail message.</em>
-<a class="jxr_linenumber" name="L766" href="#L766">766</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L767" href="#L767">767</a>         <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">IllegalBoundaryException</a>() {
-<a class="jxr_linenumber" name="L768" href="#L768">768</a>             <strong class="jxr_keyword">super</strong>();
-<a class="jxr_linenumber" name="L769" href="#L769">769</a>         }
-<a class="jxr_linenumber" name="L770" href="#L770">770</a> 
-<a class="jxr_linenumber" name="L771" href="#L771">771</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L772" href="#L772">772</a> <em class="jxr_javadoccomment">         * Constructs an &lt;code&gt;IllegalBoundaryException&lt;/code&gt; with</em>
-<a class="jxr_linenumber" name="L773" href="#L773">773</a> <em class="jxr_javadoccomment">         * the specified detail message.</em>
-<a class="jxr_linenumber" name="L774" href="#L774">774</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L775" href="#L775">775</a> <em class="jxr_javadoccomment">         * @param message The detail message.</em>
-<a class="jxr_linenumber" name="L776" href="#L776">776</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L777" href="#L777">777</a>         <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">IllegalBoundaryException</a>(String message) {
-<a class="jxr_linenumber" name="L778" href="#L778">778</a>             <strong class="jxr_keyword">super</strong>(message);
-<a class="jxr_linenumber" name="L779" href="#L779">779</a>         }
-<a class="jxr_linenumber" name="L780" href="#L780">780</a> 
-<a class="jxr_linenumber" name="L781" href="#L781">781</a>     }
-<a class="jxr_linenumber" name="L782" href="#L782">782</a> 
-<a class="jxr_linenumber" name="L783" href="#L783">783</a>     <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L784" href="#L784">784</a> <em class="jxr_javadoccomment">     * An {@link InputStream} for reading an items contents.</em>
-<a class="jxr_linenumber" name="L785" href="#L785">785</a> <em class="jxr_javadoccomment">     */</em>
-<a class="jxr_linenumber" name="L786" href="#L786">786</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">ItemInputStream</a> <strong class="jxr_keyword">extends</strong> InputStream <strong class="jxr_keyword">implements</strong> <a href="../../../../org/apache/commons/fileupload/util/Closeable.html">Closeable</a> {
-<a class="jxr_linenumber" name="L787" href="#L787">787</a> 
-<a class="jxr_linenumber" name="L788" href="#L788">788</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L789" href="#L789">789</a> <em class="jxr_javadoccomment">         * The number of bytes, which have been read so far.</em>
-<a class="jxr_linenumber" name="L790" href="#L790">790</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L791" href="#L791">791</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">long</strong> total;
-<a class="jxr_linenumber" name="L792" href="#L792">792</a> 
-<a class="jxr_linenumber" name="L793" href="#L793">793</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L794" href="#L794">794</a> <em class="jxr_javadoccomment">         * The number of bytes, which must be hold, because</em>
-<a class="jxr_linenumber" name="L795" href="#L795">795</a> <em class="jxr_javadoccomment">         * they might be a part of the boundary.</em>
-<a class="jxr_linenumber" name="L796" href="#L796">796</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L797" href="#L797">797</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> pad;
-<a class="jxr_linenumber" name="L798" href="#L798">798</a> 
-<a class="jxr_linenumber" name="L799" href="#L799">799</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L800" href="#L800">800</a> <em class="jxr_javadoccomment">         * The current offset in the buffer.</em>
-<a class="jxr_linenumber" name="L801" href="#L801">801</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L802" href="#L802">802</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> pos;
-<a class="jxr_linenumber" name="L803" href="#L803">803</a> 
-<a class="jxr_linenumber" name="L804" href="#L804">804</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L805" href="#L805">805</a> <em class="jxr_javadoccomment">         * Whether the stream is already closed.</em>
-<a class="jxr_linenumber" name="L806" href="#L806">806</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L807" href="#L807">807</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> closed;
-<a class="jxr_linenumber" name="L808" href="#L808">808</a> 
-<a class="jxr_linenumber" name="L809" href="#L809">809</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L810" href="#L810">810</a> <em class="jxr_javadoccomment">         * Creates a new instance.</em>
-<a class="jxr_linenumber" name="L811" href="#L811">811</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L812" href="#L812">812</a>         <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">ItemInputStream</a>() {
-<a class="jxr_linenumber" name="L813" href="#L813">813</a>             findSeparator();
-<a class="jxr_linenumber" name="L814" href="#L814">814</a>         }
-<a class="jxr_linenumber" name="L815" href="#L815">815</a> 
-<a class="jxr_linenumber" name="L816" href="#L816">816</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L817" href="#L817">817</a> <em class="jxr_javadoccomment">         * Called for finding the separator.</em>
-<a class="jxr_linenumber" name="L818" href="#L818">818</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L819" href="#L819">819</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> findSeparator() {
-<a class="jxr_linenumber" name="L820" href="#L820">820</a>             pos = MultipartStream.<strong class="jxr_keyword">this</strong>.findSeparator();
-<a class="jxr_linenumber" name="L821" href="#L821">821</a>             <strong class="jxr_keyword">if</strong> (pos == -1) {
-<a class="jxr_linenumber" name="L822" href="#L822">822</a>                 <strong class="jxr_keyword">if</strong> (tail - head &gt; keepRegion) {
-<a class="jxr_linenumber" name="L823" href="#L823">823</a>                     pad = keepRegion;
-<a class="jxr_linenumber" name="L824" href="#L824">824</a>                 } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="L825" href="#L825">825</a>                     pad = tail - head;
-<a class="jxr_linenumber" name="L826" href="#L826">826</a>                 }
-<a class="jxr_linenumber" name="L827" href="#L827">827</a>             }
-<a class="jxr_linenumber" name="L828" href="#L828">828</a>         }
-<a class="jxr_linenumber" name="L829" href="#L829">829</a> 
-<a class="jxr_linenumber" name="L830" href="#L830">830</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L831" href="#L831">831</a> <em class="jxr_javadoccomment">         * Returns the number of bytes, which have been read</em>
-<a class="jxr_linenumber" name="L832" href="#L832">832</a> <em class="jxr_javadoccomment">         * by the stream.</em>
-<a class="jxr_linenumber" name="L833" href="#L833">833</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L834" href="#L834">834</a> <em class="jxr_javadoccomment">         * @return Number of bytes, which have been read so far.</em>
-<a class="jxr_linenumber" name="L835" href="#L835">835</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L836" href="#L836">836</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">long</strong> getBytesRead() {
-<a class="jxr_linenumber" name="L837" href="#L837">837</a>             <strong class="jxr_keyword">return</strong> total;
-<a class="jxr_linenumber" name="L838" href="#L838">838</a>         }
-<a class="jxr_linenumber" name="L839" href="#L839">839</a> 
-<a class="jxr_linenumber" name="L840" href="#L840">840</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L841" href="#L841">841</a> <em class="jxr_javadoccomment">         * Returns the number of bytes, which are currently</em>
-<a class="jxr_linenumber" name="L842" href="#L842">842</a> <em class="jxr_javadoccomment">         * available, without blocking.</em>
-<a class="jxr_linenumber" name="L843" href="#L843">843</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L844" href="#L844">844</a> <em class="jxr_javadoccomment">         * @throws IOException An I/O error occurs.</em>
-<a class="jxr_linenumber" name="L845" href="#L845">845</a> <em class="jxr_javadoccomment">         * @return Number of bytes in the buffer.</em>
-<a class="jxr_linenumber" name="L846" href="#L846">846</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L847" href="#L847">847</a>         @Override
-<a class="jxr_linenumber" name="L848" href="#L848">848</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> available() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="L849" href="#L849">849</a>             <strong class="jxr_keyword">if</strong> (pos == -1) {
-<a class="jxr_linenumber" name="L850" href="#L850">850</a>                 <strong class="jxr_keyword">return</strong> tail - head - pad;
-<a class="jxr_linenumber" name="L851" href="#L851">851</a>             }
-<a class="jxr_linenumber" name="L852" href="#L852">852</a>             <strong class="jxr_keyword">return</strong> pos - head;
-<a class="jxr_linenumber" name="L853" href="#L853">853</a>         }
-<a class="jxr_linenumber" name="L854" href="#L854">854</a> 
-<a class="jxr_linenumber" name="L855" href="#L855">855</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L856" href="#L856">856</a> <em class="jxr_javadoccomment">         * Offset when converting negative bytes to integers.</em>
-<a class="jxr_linenumber" name="L857" href="#L857">857</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L858" href="#L858">858</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> BYTE_POSITIVE_OFFSET = 256;
-<a class="jxr_linenumber" name="L859" href="#L859">859</a> 
-<a class="jxr_linenumber" name="L860" href="#L860">860</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L861" href="#L861">861</a> <em class="jxr_javadoccomment">         * Returns the next byte in the stream.</em>
-<a class="jxr_linenumber" name="L862" href="#L862">862</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L863" href="#L863">863</a> <em class="jxr_javadoccomment">         * @return The next byte in the stream, as a non-negative</em>
-<a class="jxr_linenumber" name="L864" href="#L864">864</a> <em class="jxr_javadoccomment">         *   integer, or -1 for EOF.</em>
-<a class="jxr_linenumber" name="L865" href="#L865">865</a> <em class="jxr_javadoccomment">         * @throws IOException An I/O error occurred.</em>
-<a class="jxr_linenumber" name="L866" href="#L866">866</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L867" href="#L867">867</a>         @Override
-<a class="jxr_linenumber" name="L868" href="#L868">868</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> read() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="L869" href="#L869">869</a>             <strong class="jxr_keyword">if</strong> (closed) {
-<a class="jxr_linenumber" name="L870" href="#L870">870</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> FileItemStream.ItemSkippedException();
-<a class="jxr_linenumber" name="L871" href="#L871">871</a>             }
-<a class="jxr_linenumber" name="L872" href="#L872">872</a>             <strong class="jxr_keyword">if</strong> (available() == 0 &amp;&amp; makeAvailable() == 0) {
-<a class="jxr_linenumber" name="L873" href="#L873">873</a>                 <strong class="jxr_keyword">return</strong> -1;
-<a class="jxr_linenumber" name="L874" href="#L874">874</a>             }
-<a class="jxr_linenumber" name="L875" href="#L875">875</a>             ++total;
-<a class="jxr_linenumber" name="L876" href="#L876">876</a>             <strong class="jxr_keyword">int</strong> b = buffer[head++];
-<a class="jxr_linenumber" name="L877" href="#L877">877</a>             <strong class="jxr_keyword">if</strong> (b &gt;= 0) {
-<a class="jxr_linenumber" name="L878" href="#L878">878</a>                 <strong class="jxr_keyword">return</strong> b;
-<a class="jxr_linenumber" name="L879" href="#L879">879</a>             }
-<a class="jxr_linenumber" name="L880" href="#L880">880</a>             <strong class="jxr_keyword">return</strong> b + BYTE_POSITIVE_OFFSET;
-<a class="jxr_linenumber" name="L881" href="#L881">881</a>         }
-<a class="jxr_linenumber" name="L882" href="#L882">882</a> 
-<a class="jxr_linenumber" name="L883" href="#L883">883</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L884" href="#L884">884</a> <em class="jxr_javadoccomment">         * Reads bytes into the given buffer.</em>
-<a class="jxr_linenumber" name="L885" href="#L885">885</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L886" href="#L886">886</a> <em class="jxr_javadoccomment">         * @param b The destination buffer, where to write to.</em>
-<a class="jxr_linenumber" name="L887" href="#L887">887</a> <em class="jxr_javadoccomment">         * @param off Offset of the first byte in the buffer.</em>
-<a class="jxr_linenumber" name="L888" href="#L888">888</a> <em class="jxr_javadoccomment">         * @param len Maximum number of bytes to read.</em>
-<a class="jxr_linenumber" name="L889" href="#L889">889</a> <em class="jxr_javadoccomment">         * @return Number of bytes, which have been actually read,</em>
-<a class="jxr_linenumber" name="L890" href="#L890">890</a> <em class="jxr_javadoccomment">         *   or -1 for EOF.</em>
-<a class="jxr_linenumber" name="L891" href="#L891">891</a> <em class="jxr_javadoccomment">         * @throws IOException An I/O error occurred.</em>
-<a class="jxr_linenumber" name="L892" href="#L892">892</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L893" href="#L893">893</a>         @Override
-<a class="jxr_linenumber" name="L894" href="#L894">894</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> read(byte[] b, <strong class="jxr_keyword">int</strong> off, <strong class="jxr_keyword">int</strong> len) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="L895" href="#L895">895</a>             <strong class="jxr_keyword">if</strong> (closed) {
-<a class="jxr_linenumber" name="L896" href="#L896">896</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> FileItemStream.ItemSkippedException();
-<a class="jxr_linenumber" name="L897" href="#L897">897</a>             }
-<a class="jxr_linenumber" name="L898" href="#L898">898</a>             <strong class="jxr_keyword">if</strong> (len == 0) {
-<a class="jxr_linenumber" name="L899" href="#L899">899</a>                 <strong class="jxr_keyword">return</strong> 0;
-<a class="jxr_linenumber" name="L900" href="#L900">900</a>             }
-<a class="jxr_linenumber" name="L901" href="#L901">901</a>             <strong class="jxr_keyword">int</strong> res = available();
-<a class="jxr_linenumber" name="L902" href="#L902">902</a>             <strong class="jxr_keyword">if</strong> (res == 0) {
-<a class="jxr_linenumber" name="L903" href="#L903">903</a>                 res = makeAvailable();
-<a class="jxr_linenumber" name="L904" href="#L904">904</a>                 <strong class="jxr_keyword">if</strong> (res == 0) {
-<a class="jxr_linenumber" name="L905" href="#L905">905</a>                     <strong class="jxr_keyword">return</strong> -1;
-<a class="jxr_linenumber" name="L906" href="#L906">906</a>                 }
-<a class="jxr_linenumber" name="L907" href="#L907">907</a>             }
-<a class="jxr_linenumber" name="L908" href="#L908">908</a>             res = Math.min(res, len);
-<a class="jxr_linenumber" name="L909" href="#L909">909</a>             System.arraycopy(buffer, head, b, off, res);
-<a class="jxr_linenumber" name="L910" href="#L910">910</a>             head += res;
-<a class="jxr_linenumber" name="L911" href="#L911">911</a>             total += res;
-<a class="jxr_linenumber" name="L912" href="#L912">912</a>             <strong class="jxr_keyword">return</strong> res;
-<a class="jxr_linenumber" name="L913" href="#L913">913</a>         }
-<a class="jxr_linenumber" name="L914" href="#L914">914</a> 
-<a class="jxr_linenumber" name="L915" href="#L915">915</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L916" href="#L916">916</a> <em class="jxr_javadoccomment">         * Closes the input stream.</em>
-<a class="jxr_linenumber" name="L917" href="#L917">917</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L918" href="#L918">918</a> <em class="jxr_javadoccomment">         * @throws IOException An I/O error occurred.</em>
-<a class="jxr_linenumber" name="L919" href="#L919">919</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L920" href="#L920">920</a>         @Override
-<a class="jxr_linenumber" name="L921" href="#L921">921</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> close() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="L922" href="#L922">922</a>             close(false);
-<a class="jxr_linenumber" name="L923" href="#L923">923</a>         }
-<a class="jxr_linenumber" name="L924" href="#L924">924</a> 
-<a class="jxr_linenumber" name="L925" href="#L925">925</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L926" href="#L926">926</a> <em class="jxr_javadoccomment">         * Closes the input stream.</em>
-<a class="jxr_linenumber" name="L927" href="#L927">927</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L928" href="#L928">928</a> <em class="jxr_javadoccomment">         * @param pCloseUnderlying Whether to close the underlying stream</em>
-<a class="jxr_linenumber" name="L929" href="#L929">929</a> <em class="jxr_javadoccomment">         *   (hard close)</em>
-<a class="jxr_linenumber" name="L930" href="#L930">930</a> <em class="jxr_javadoccomment">         * @throws IOException An I/O error occurred.</em>
-<a class="jxr_linenumber" name="L931" href="#L931">931</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L932" href="#L932">932</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> close(<strong class="jxr_keyword">boolean</strong> pCloseUnderlying) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="L933" href="#L933">933</a>             <strong class="jxr_keyword">if</strong> (closed) {
-<a class="jxr_linenumber" name="L934" href="#L934">934</a>                 <strong class="jxr_keyword">return</strong>;
-<a class="jxr_linenumber" name="L935" href="#L935">935</a>             }
-<a class="jxr_linenumber" name="L936" href="#L936">936</a>             <strong class="jxr_keyword">if</strong> (pCloseUnderlying) {
-<a class="jxr_linenumber" name="L937" href="#L937">937</a>                 closed = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="L938" href="#L938">938</a>                 input.close();
-<a class="jxr_linenumber" name="L939" href="#L939">939</a>             } <strong class="jxr_keyword">else</strong> {
-<a class="jxr_linenumber" name="L940" href="#L940">940</a>                 <strong class="jxr_keyword">for</strong> (;;) {
-<a class="jxr_linenumber" name="L941" href="#L941">941</a>                     <strong class="jxr_keyword">int</strong> av = available();
-<a class="jxr_linenumber" name="L942" href="#L942">942</a>                     <strong class="jxr_keyword">if</strong> (av == 0) {
-<a class="jxr_linenumber" name="L943" href="#L943">943</a>                         av = makeAvailable();
-<a class="jxr_linenumber" name="L944" href="#L944">944</a>                         <strong class="jxr_keyword">if</strong> (av == 0) {
-<a class="jxr_linenumber" name="L945" href="#L945">945</a>                             <strong class="jxr_keyword">break</strong>;
-<a class="jxr_linenumber" name="L946" href="#L946">946</a>                         }
-<a class="jxr_linenumber" name="L947" href="#L947">947</a>                     }
-<a class="jxr_linenumber" name="L948" href="#L948">948</a>                     skip(av);
-<a class="jxr_linenumber" name="L949" href="#L949">949</a>                 }
-<a class="jxr_linenumber" name="L950" href="#L950">950</a>             }
-<a class="jxr_linenumber" name="L951" href="#L951">951</a>             closed = <strong class="jxr_keyword">true</strong>;
-<a class="jxr_linenumber" name="L952" href="#L952">952</a>         }
-<a class="jxr_linenumber" name="L953" href="#L953">953</a> 
-<a class="jxr_linenumber" name="L954" href="#L954">954</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L955" href="#L955">955</a> <em class="jxr_javadoccomment">         * Skips the given number of bytes.</em>
-<a class="jxr_linenumber" name="L956" href="#L956">956</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L957" href="#L957">957</a> <em class="jxr_javadoccomment">         * @param bytes Number of bytes to skip.</em>
-<a class="jxr_linenumber" name="L958" href="#L958">958</a> <em class="jxr_javadoccomment">         * @return The number of bytes, which have actually been</em>
-<a class="jxr_linenumber" name="L959" href="#L959">959</a> <em class="jxr_javadoccomment">         *   skipped.</em>
-<a class="jxr_linenumber" name="L960" href="#L960">960</a> <em class="jxr_javadoccomment">         * @throws IOException An I/O error occurred.</em>
-<a class="jxr_linenumber" name="L961" href="#L961">961</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L962" href="#L962">962</a>         @Override
-<a class="jxr_linenumber" name="L963" href="#L963">963</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">long</strong> skip(<strong class="jxr_keyword">long</strong> bytes) <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="L964" href="#L964">964</a>             <strong class="jxr_keyword">if</strong> (closed) {
-<a class="jxr_linenumber" name="L965" href="#L965">965</a>                 <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> FileItemStream.ItemSkippedException();
-<a class="jxr_linenumber" name="L966" href="#L966">966</a>             }
-<a class="jxr_linenumber" name="L967" href="#L967">967</a>             <strong class="jxr_keyword">int</strong> av = available();
-<a class="jxr_linenumber" name="L968" href="#L968">968</a>             <strong class="jxr_keyword">if</strong> (av == 0) {
-<a class="jxr_linenumber" name="L969" href="#L969">969</a>                 av = makeAvailable();
-<a class="jxr_linenumber" name="L970" href="#L970">970</a>                 <strong class="jxr_keyword">if</strong> (av == 0) {
-<a class="jxr_linenumber" name="L971" href="#L971">971</a>                     <strong class="jxr_keyword">return</strong> 0;
-<a class="jxr_linenumber" name="L972" href="#L972">972</a>                 }
-<a class="jxr_linenumber" name="L973" href="#L973">973</a>             }
-<a class="jxr_linenumber" name="L974" href="#L974">974</a>             <strong class="jxr_keyword">long</strong> res = Math.min(av, bytes);
-<a class="jxr_linenumber" name="L975" href="#L975">975</a>             head += res;
-<a class="jxr_linenumber" name="L976" href="#L976">976</a>             <strong class="jxr_keyword">return</strong> res;
-<a class="jxr_linenumber" name="L977" href="#L977">977</a>         }
-<a class="jxr_linenumber" name="L978" href="#L978">978</a> 
-<a class="jxr_linenumber" name="L979" href="#L979">979</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L980" href="#L980">980</a> <em class="jxr_javadoccomment">         * Attempts to read more data.</em>
-<a class="jxr_linenumber" name="L981" href="#L981">981</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L982" href="#L982">982</a> <em class="jxr_javadoccomment">         * @return Number of available bytes</em>
-<a class="jxr_linenumber" name="L983" href="#L983">983</a> <em class="jxr_javadoccomment">         * @throws IOException An I/O error occurred.</em>
-<a class="jxr_linenumber" name="L984" href="#L984">984</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L985" href="#L985">985</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> makeAvailable() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="L986" href="#L986">986</a>             <strong class="jxr_keyword">if</strong> (pos != -1) {
-<a class="jxr_linenumber" name="L987" href="#L987">987</a>                 <strong class="jxr_keyword">return</strong> 0;
-<a class="jxr_linenumber" name="L988" href="#L988">988</a>             }
-<a class="jxr_linenumber" name="L989" href="#L989">989</a> 
-<a class="jxr_linenumber" name="L990" href="#L990">990</a>             <em class="jxr_comment">// Move the data to the beginning of the buffer.</em>
-<a class="jxr_linenumber" name="L991" href="#L991">991</a>             total += tail - head - pad;
-<a class="jxr_linenumber" name="L992" href="#L992">992</a>             System.arraycopy(buffer, tail - pad, buffer, 0, pad);
-<a class="jxr_linenumber" name="L993" href="#L993">993</a> 
-<a class="jxr_linenumber" name="L994" href="#L994">994</a>             <em class="jxr_comment">// Refill buffer with new data.</em>
-<a class="jxr_linenumber" name="L995" href="#L995">995</a>             head = 0;
-<a class="jxr_linenumber" name="L996" href="#L996">996</a>             tail = pad;
-<a class="jxr_linenumber" name="L997" href="#L997">997</a> 
-<a class="jxr_linenumber" name="L998" href="#L998">998</a>             <strong class="jxr_keyword">for</strong> (;;) {
-<a class="jxr_linenumber" name="L999" href="#L999">999</a>                 <strong class="jxr_keyword">int</strong> bytesRead = input.read(buffer, tail, bufSize - tail);
-<a class="jxr_linenumber" name="L1000" href="#L1000">1000</a>                 <strong class="jxr_keyword">if</strong> (bytesRead == -1) {
-<a class="jxr_linenumber" name="L1001" href="#L1001">1001</a>                     <em class="jxr_comment">// The last pad amount is left in the buffer.</em>
-<a class="jxr_linenumber" name="L1002" href="#L1002">1002</a>                     <em class="jxr_comment">// Boundary can't be in there so signal an error</em>
-<a class="jxr_linenumber" name="L1003" href="#L1003">1003</a>                     <em class="jxr_comment">// condition.</em>
-<a class="jxr_linenumber" name="L1004" href="#L1004">1004</a>                     <strong class="jxr_keyword">final</strong> String msg = <span class="jxr_string">"Stream ended unexpectedly"</span>;
-<a class="jxr_linenumber" name="L1005" href="#L1005">1005</a>                     <strong class="jxr_keyword">throw</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">MalformedStreamException</a>(msg);
-<a class="jxr_linenumber" name="L1006" href="#L1006">1006</a>                 }
-<a class="jxr_linenumber" name="L1007" href="#L1007">1007</a>                 <strong class="jxr_keyword">if</strong> (notifier != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="L1008" href="#L1008">1008</a>                     notifier.noteBytesRead(bytesRead);
-<a class="jxr_linenumber" name="L1009" href="#L1009">1009</a>                 }
-<a class="jxr_linenumber" name="L1010" href="#L1010">1010</a>                 tail += bytesRead;
-<a class="jxr_linenumber" name="L1011" href="#L1011">1011</a> 
-<a class="jxr_linenumber" name="L1012" href="#L1012">1012</a>                 findSeparator();
-<a class="jxr_linenumber" name="L1013" href="#L1013">1013</a>                 <strong class="jxr_keyword">int</strong> av = available();
-<a class="jxr_linenumber" name="L1014" href="#L1014">1014</a> 
-<a class="jxr_linenumber" name="L1015" href="#L1015">1015</a>                 <strong class="jxr_keyword">if</strong> (av &gt; 0 || pos != -1) {
-<a class="jxr_linenumber" name="L1016" href="#L1016">1016</a>                     <strong class="jxr_keyword">return</strong> av;
-<a class="jxr_linenumber" name="L1017" href="#L1017">1017</a>                 }
-<a class="jxr_linenumber" name="L1018" href="#L1018">1018</a>             }
-<a class="jxr_linenumber" name="L1019" href="#L1019">1019</a>         }
-<a class="jxr_linenumber" name="L1020" href="#L1020">1020</a> 
-<a class="jxr_linenumber" name="L1021" href="#L1021">1021</a>         <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="L1022" href="#L1022">1022</a> <em class="jxr_javadoccomment">         * Returns, whether the stream is closed.</em>
-<a class="jxr_linenumber" name="L1023" href="#L1023">1023</a> <em class="jxr_javadoccomment">         *</em>
-<a class="jxr_linenumber" name="L1024" href="#L1024">1024</a> <em class="jxr_javadoccomment">         * @return True, if the stream is closed, otherwise false.</em>
-<a class="jxr_linenumber" name="L1025" href="#L1025">1025</a> <em class="jxr_javadoccomment">         */</em>
-<a class="jxr_linenumber" name="L1026" href="#L1026">1026</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> isClosed() {
-<a class="jxr_linenumber" name="L1027" href="#L1027">1027</a>             <strong class="jxr_keyword">return</strong> closed;
-<a class="jxr_linenumber" name="L1028" href="#L1028">1028</a>         }
-<a class="jxr_linenumber" name="L1029" href="#L1029">1029</a> 
-<a class="jxr_linenumber" name="L1030" href="#L1030">1030</a>     }
-<a class="jxr_linenumber" name="L1031" href="#L1031">1031</a> 
-<a class="jxr_linenumber" name="L1032" href="#L1032">1032</a> }
+<a class="jxr_linenumber" name="L592" href="#L592">592</a>         <strong class="jxr_keyword">return</strong> (<strong class="jxr_keyword">int</strong>) Streams.copy(newInputStream(), output, false); <em class="jxr_comment">// N.B. Streams.copy closes the input stream</em>
+<a class="jxr_linenumber" name="L593" href="#L593">593</a>     }
+<a class="jxr_linenumber" name="L594" href="#L594">594</a> 
+<a class="jxr_linenumber" name="L595" href="#L595">595</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L596" href="#L596">596</a> <em class="jxr_javadoccomment">     * Creates a new {@link ItemInputStream}.</em>
+<a class="jxr_linenumber" name="L597" href="#L597">597</a> <em class="jxr_javadoccomment">     * @return A new instance of {@link ItemInputStream}.</em>
+<a class="jxr_linenumber" name="L598" href="#L598">598</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L599" href="#L599">599</a>     <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">ItemInputStream</a> newInputStream() {
+<a class="jxr_linenumber" name="L600" href="#L600">600</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">ItemInputStream</a>();
+<a class="jxr_linenumber" name="L601" href="#L601">601</a>     }
+<a class="jxr_linenumber" name="L602" href="#L602">602</a> 
+<a class="jxr_linenumber" name="L603" href="#L603">603</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L604" href="#L604">604</a> <em class="jxr_javadoccomment">     * &lt;p&gt; Reads &lt;code&gt;body-data&lt;/code&gt; from the current</em>
+<a class="jxr_linenumber" name="L605" href="#L605">605</a> <em class="jxr_javadoccomment">     * &lt;code&gt;encapsulation&lt;/code&gt; and discards it.</em>
+<a class="jxr_linenumber" name="L606" href="#L606">606</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L607" href="#L607">607</a> <em class="jxr_javadoccomment">     * &lt;p&gt;Use this method to skip encapsulations you don't need or don't</em>
+<a class="jxr_linenumber" name="L608" href="#L608">608</a> <em class="jxr_javadoccomment">     * understand.</em>
+<a class="jxr_linenumber" name="L609" href="#L609">609</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L610" href="#L610">610</a> <em class="jxr_javadoccomment">     * @return The amount of data discarded.</em>
+<a class="jxr_linenumber" name="L611" href="#L611">611</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L612" href="#L612">612</a> <em class="jxr_javadoccomment">     * @throws MalformedStreamException if the stream ends unexpectedly.</em>
+<a class="jxr_linenumber" name="L613" href="#L613">613</a> <em class="jxr_javadoccomment">     * @throws IOException              if an i/o error occurs.</em>
+<a class="jxr_linenumber" name="L614" href="#L614">614</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L615" href="#L615">615</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">int</strong> discardBodyData() <strong class="jxr_keyword">throws</strong> MalformedStreamException, IOException {
+<a class="jxr_linenumber" name="L616" href="#L616">616</a>         <strong class="jxr_keyword">return</strong> readBodyData(<strong class="jxr_keyword">null</strong>);
+<a class="jxr_linenumber" name="L617" href="#L617">617</a>     }
+<a class="jxr_linenumber" name="L618" href="#L618">618</a> 
+<a class="jxr_linenumber" name="L619" href="#L619">619</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L620" href="#L620">620</a> <em class="jxr_javadoccomment">     * Finds the beginning of the first &lt;code&gt;encapsulation&lt;/code&gt;.</em>
+<a class="jxr_linenumber" name="L621" href="#L621">621</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L622" href="#L622">622</a> <em class="jxr_javadoccomment">     * @return &lt;code&gt;true&lt;/code&gt; if an &lt;code&gt;encapsulation&lt;/code&gt; was found in</em>
+<a class="jxr_linenumber" name="L623" href="#L623">623</a> <em class="jxr_javadoccomment">     *         the stream.</em>
+<a class="jxr_linenumber" name="L624" href="#L624">624</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L625" href="#L625">625</a> <em class="jxr_javadoccomment">     * @throws IOException if an i/o error occurs.</em>
+<a class="jxr_linenumber" name="L626" href="#L626">626</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L627" href="#L627">627</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">boolean</strong> skipPreamble() <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="L628" href="#L628">628</a>         <em class="jxr_comment">// First delimiter may be not preceeded with a CRLF.</em>
+<a class="jxr_linenumber" name="L629" href="#L629">629</a>         System.arraycopy(boundary, 2, boundary, 0, boundary.length - 2);
+<a class="jxr_linenumber" name="L630" href="#L630">630</a>         boundaryLength = boundary.length - 2;
+<a class="jxr_linenumber" name="L631" href="#L631">631</a>         <strong class="jxr_keyword">try</strong> {
+<a class="jxr_linenumber" name="L632" href="#L632">632</a>             <em class="jxr_comment">// Discard all data up to the delimiter.</em>
+<a class="jxr_linenumber" name="L633" href="#L633">633</a>             discardBodyData();
+<a class="jxr_linenumber" name="L634" href="#L634">634</a> 
+<a class="jxr_linenumber" name="L635" href="#L635">635</a>             <em class="jxr_comment">// Read boundary - if succeeded, the stream contains an</em>
+<a class="jxr_linenumber" name="L636" href="#L636">636</a>             <em class="jxr_comment">// encapsulation.</em>
+<a class="jxr_linenumber" name="L637" href="#L637">637</a>             <strong class="jxr_keyword">return</strong> readBoundary();
+<a class="jxr_linenumber" name="L638" href="#L638">638</a>         } <strong class="jxr_keyword">catch</strong> (MalformedStreamException e) {
+<a class="jxr_linenumber" name="L639" href="#L639">639</a>             <strong class="jxr_keyword">return</strong> false;
+<a class="jxr_linenumber" name="L640" href="#L640">640</a>         } <strong class="jxr_keyword">finally</strong> {
+<a class="jxr_linenumber" name="L641" href="#L641">641</a>             <em class="jxr_comment">// Restore delimiter.</em>
+<a class="jxr_linenumber" name="L642" href="#L642">642</a>             System.arraycopy(boundary, 0, boundary, 2, boundary.length - 2);
+<a class="jxr_linenumber" name="L643" href="#L643">643</a>             boundaryLength = boundary.length;
+<a class="jxr_linenumber" name="L644" href="#L644">644</a>             boundary[0] = CR;
+<a class="jxr_linenumber" name="L645" href="#L645">645</a>             boundary[1] = LF;
+<a class="jxr_linenumber" name="L646" href="#L646">646</a>         }
+<a class="jxr_linenumber" name="L647" href="#L647">647</a>     }
+<a class="jxr_linenumber" name="L648" href="#L648">648</a> 
+<a class="jxr_linenumber" name="L649" href="#L649">649</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L650" href="#L650">650</a> <em class="jxr_javadoccomment">     * Compares &lt;code&gt;count&lt;/code&gt; first bytes in the arrays</em>
+<a class="jxr_linenumber" name="L651" href="#L651">651</a> <em class="jxr_javadoccomment">     * &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt;.</em>
+<a class="jxr_linenumber" name="L652" href="#L652">652</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L653" href="#L653">653</a> <em class="jxr_javadoccomment">     * @param a     The first array to compare.</em>
+<a class="jxr_linenumber" name="L654" href="#L654">654</a> <em class="jxr_javadoccomment">     * @param b     The second array to compare.</em>
+<a class="jxr_linenumber" name="L655" href="#L655">655</a> <em class="jxr_javadoccomment">     * @param count How many bytes should be compared.</em>
+<a class="jxr_linenumber" name="L656" href="#L656">656</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L657" href="#L657">657</a> <em class="jxr_javadoccomment">     * @return &lt;code&gt;true&lt;/code&gt; if &lt;code&gt;count&lt;/code&gt; first bytes in arrays</em>
+<a class="jxr_linenumber" name="L658" href="#L658">658</a> <em class="jxr_javadoccomment">     *         &lt;code&gt;a&lt;/code&gt; and &lt;code&gt;b&lt;/code&gt; are equal.</em>
+<a class="jxr_linenumber" name="L659" href="#L659">659</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L660" href="#L660">660</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">boolean</strong> arrayequals(byte[] a,
+<a class="jxr_linenumber" name="L661" href="#L661">661</a>             byte[] b,
+<a class="jxr_linenumber" name="L662" href="#L662">662</a>             <strong class="jxr_keyword">int</strong> count) {
+<a class="jxr_linenumber" name="L663" href="#L663">663</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; count; i++) {
+<a class="jxr_linenumber" name="L664" href="#L664">664</a>             <strong class="jxr_keyword">if</strong> (a[i] != b[i]) {
+<a class="jxr_linenumber" name="L665" href="#L665">665</a>                 <strong class="jxr_keyword">return</strong> false;
+<a class="jxr_linenumber" name="L666" href="#L666">666</a>             }
+<a class="jxr_linenumber" name="L667" href="#L667">667</a>         }
+<a class="jxr_linenumber" name="L668" href="#L668">668</a>         <strong class="jxr_keyword">return</strong> <strong class="jxr_keyword">true</strong>;
+<a class="jxr_linenumber" name="L669" href="#L669">669</a>     }
+<a class="jxr_linenumber" name="L670" href="#L670">670</a> 
+<a class="jxr_linenumber" name="L671" href="#L671">671</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L672" href="#L672">672</a> <em class="jxr_javadoccomment">     * Searches for a byte of specified value in the &lt;code&gt;buffer&lt;/code&gt;,</em>
+<a class="jxr_linenumber" name="L673" href="#L673">673</a> <em class="jxr_javadoccomment">     * starting at the specified &lt;code&gt;position&lt;/code&gt;.</em>
+<a class="jxr_linenumber" name="L674" href="#L674">674</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L675" href="#L675">675</a> <em class="jxr_javadoccomment">     * @param value The value to find.</em>
+<a class="jxr_linenumber" name="L676" href="#L676">676</a> <em class="jxr_javadoccomment">     * @param pos   The starting position for searching.</em>
+<a class="jxr_linenumber" name="L677" href="#L677">677</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L678" href="#L678">678</a> <em class="jxr_javadoccomment">     * @return The position of byte found, counting from beginning of the</em>
+<a class="jxr_linenumber" name="L679" href="#L679">679</a> <em class="jxr_javadoccomment">     *         &lt;code&gt;buffer&lt;/code&gt;, or &lt;code&gt;-1&lt;/code&gt; if not found.</em>
+<a class="jxr_linenumber" name="L680" href="#L680">680</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L681" href="#L681">681</a>     <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">int</strong> findByte(byte value,
+<a class="jxr_linenumber" name="L682" href="#L682">682</a>             <strong class="jxr_keyword">int</strong> pos) {
+<a class="jxr_linenumber" name="L683" href="#L683">683</a>         <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = pos; i &lt; tail; i++) {
+<a class="jxr_linenumber" name="L684" href="#L684">684</a>             <strong class="jxr_keyword">if</strong> (buffer[i] == value) {
+<a class="jxr_linenumber" name="L685" href="#L685">685</a>                 <strong class="jxr_keyword">return</strong> i;
+<a class="jxr_linenumber" name="L686" href="#L686">686</a>             }
+<a class="jxr_linenumber" name="L687" href="#L687">687</a>         }
+<a class="jxr_linenumber" name="L688" href="#L688">688</a> 
+<a class="jxr_linenumber" name="L689" href="#L689">689</a>         <strong class="jxr_keyword">return</strong> -1;
+<a class="jxr_linenumber" name="L690" href="#L690">690</a>     }
+<a class="jxr_linenumber" name="L691" href="#L691">691</a> 
+<a class="jxr_linenumber" name="L692" href="#L692">692</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L693" href="#L693">693</a> <em class="jxr_javadoccomment">     * Searches for the &lt;code&gt;boundary&lt;/code&gt; in the &lt;code&gt;buffer&lt;/code&gt;</em>
+<a class="jxr_linenumber" name="L694" href="#L694">694</a> <em class="jxr_javadoccomment">     * region delimited by &lt;code&gt;head&lt;/code&gt; and &lt;code&gt;tail&lt;/code&gt;.</em>
+<a class="jxr_linenumber" name="L695" href="#L695">695</a> <em class="jxr_javadoccomment">     *</em>
+<a class="jxr_linenumber" name="L696" href="#L696">696</a> <em class="jxr_javadoccomment">     * @return The position of the boundary found, counting from the</em>
+<a class="jxr_linenumber" name="L697" href="#L697">697</a> <em class="jxr_javadoccomment">     *         beginning of the &lt;code&gt;buffer&lt;/code&gt;, or &lt;code&gt;-1&lt;/code&gt; if</em>
+<a class="jxr_linenumber" name="L698" href="#L698">698</a> <em class="jxr_javadoccomment">     *         not found.</em>
+<a class="jxr_linenumber" name="L699" href="#L699">699</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L700" href="#L700">700</a>     <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">int</strong> findSeparator() {
+<a class="jxr_linenumber" name="L701" href="#L701">701</a>         <strong class="jxr_keyword">int</strong> first;
+<a class="jxr_linenumber" name="L702" href="#L702">702</a>         <strong class="jxr_keyword">int</strong> match = 0;
+<a class="jxr_linenumber" name="L703" href="#L703">703</a>         <strong class="jxr_keyword">int</strong> maxpos = tail - boundaryLength;
+<a class="jxr_linenumber" name="L704" href="#L704">704</a>         <strong class="jxr_keyword">for</strong> (first = head; first &lt;= maxpos &amp;&amp; match != boundaryLength; first++) {
+<a class="jxr_linenumber" name="L705" href="#L705">705</a>             first = findByte(boundary[0], first);
+<a class="jxr_linenumber" name="L706" href="#L706">706</a>             <strong class="jxr_keyword">if</strong> (first == -1 || first &gt; maxpos) {
+<a class="jxr_linenumber" name="L707" href="#L707">707</a>                 <strong class="jxr_keyword">return</strong> -1;
+<a class="jxr_linenumber" name="L708" href="#L708">708</a>             }
+<a class="jxr_linenumber" name="L709" href="#L709">709</a>             <strong class="jxr_keyword">for</strong> (match = 1; match &lt; boundaryLength; match++) {
+<a class="jxr_linenumber" name="L710" href="#L710">710</a>                 <strong class="jxr_keyword">if</strong> (buffer[first + match] != boundary[match]) {
+<a class="jxr_linenumber" name="L711" href="#L711">711</a>                     <strong class="jxr_keyword">break</strong>;
+<a class="jxr_linenumber" name="L712" href="#L712">712</a>                 }
+<a class="jxr_linenumber" name="L713" href="#L713">713</a>             }
+<a class="jxr_linenumber" name="L714" href="#L714">714</a>         }
+<a class="jxr_linenumber" name="L715" href="#L715">715</a>         <strong class="jxr_keyword">if</strong> (match == boundaryLength) {
+<a class="jxr_linenumber" name="L716" href="#L716">716</a>             <strong class="jxr_keyword">return</strong> first - 1;
+<a class="jxr_linenumber" name="L717" href="#L717">717</a>         }
+<a class="jxr_linenumber" name="L718" href="#L718">718</a>         <strong class="jxr_keyword">return</strong> -1;
+<a class="jxr_linenumber" name="L719" href="#L719">719</a>     }
+<a class="jxr_linenumber" name="L720" href="#L720">720</a> 
+<a class="jxr_linenumber" name="L721" href="#L721">721</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L722" href="#L722">722</a> <em class="jxr_javadoccomment">     * Thrown to indicate that the input stream fails to follow the</em>
+<a class="jxr_linenumber" name="L723" href="#L723">723</a> <em class="jxr_javadoccomment">     * required syntax.</em>
+<a class="jxr_linenumber" name="L724" href="#L724">724</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L725" href="#L725">725</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">MalformedStreamException</a> <strong class="jxr_keyword">extends</strong> IOException {
+<a class="jxr_linenumber" name="L726" href="#L726">726</a> 
+<a class="jxr_linenumber" name="L727" href="#L727">727</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L728" href="#L728">728</a> <em class="jxr_javadoccomment">         * The UID to use when serializing this instance.</em>
+<a class="jxr_linenumber" name="L729" href="#L729">729</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L730" href="#L730">730</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> serialVersionUID = 6466926458059796677L;
+<a class="jxr_linenumber" name="L731" href="#L731">731</a> 
+<a class="jxr_linenumber" name="L732" href="#L732">732</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L733" href="#L733">733</a> <em class="jxr_javadoccomment">         * Constructs a &lt;code&gt;MalformedStreamException&lt;/code&gt; with no</em>
+<a class="jxr_linenumber" name="L734" href="#L734">734</a> <em class="jxr_javadoccomment">         * detail message.</em>
+<a class="jxr_linenumber" name="L735" href="#L735">735</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L736" href="#L736">736</a>         <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">MalformedStreamException</a>() {
+<a class="jxr_linenumber" name="L737" href="#L737">737</a>             <strong class="jxr_keyword">super</strong>();
+<a class="jxr_linenumber" name="L738" href="#L738">738</a>         }
+<a class="jxr_linenumber" name="L739" href="#L739">739</a> 
+<a class="jxr_linenumber" name="L740" href="#L740">740</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L741" href="#L741">741</a> <em class="jxr_javadoccomment">         * Constructs an &lt;code&gt;MalformedStreamException&lt;/code&gt; with</em>
+<a class="jxr_linenumber" name="L742" href="#L742">742</a> <em class="jxr_javadoccomment">         * the specified detail message.</em>
+<a class="jxr_linenumber" name="L743" href="#L743">743</a> <em class="jxr_javadoccomment">         *</em>
+<a class="jxr_linenumber" name="L744" href="#L744">744</a> <em class="jxr_javadoccomment">         * @param message The detail message.</em>
+<a class="jxr_linenumber" name="L745" href="#L745">745</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L746" href="#L746">746</a>         <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">MalformedStreamException</a>(String message) {
+<a class="jxr_linenumber" name="L747" href="#L747">747</a>             <strong class="jxr_keyword">super</strong>(message);
+<a class="jxr_linenumber" name="L748" href="#L748">748</a>         }
+<a class="jxr_linenumber" name="L749" href="#L749">749</a> 
+<a class="jxr_linenumber" name="L750" href="#L750">750</a>     }
+<a class="jxr_linenumber" name="L751" href="#L751">751</a> 
+<a class="jxr_linenumber" name="L752" href="#L752">752</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L753" href="#L753">753</a> <em class="jxr_javadoccomment">     * Thrown upon attempt of setting an invalid boundary token.</em>
+<a class="jxr_linenumber" name="L754" href="#L754">754</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L755" href="#L755">755</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">IllegalBoundaryException</a> <strong class="jxr_keyword">extends</strong> IOException {
+<a class="jxr_linenumber" name="L756" href="#L756">756</a> 
+<a class="jxr_linenumber" name="L757" href="#L757">757</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L758" href="#L758">758</a> <em class="jxr_javadoccomment">         * The UID to use when serializing this instance.</em>
+<a class="jxr_linenumber" name="L759" href="#L759">759</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L760" href="#L760">760</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> serialVersionUID = -161533165102632918L;
+<a class="jxr_linenumber" name="L761" href="#L761">761</a> 
+<a class="jxr_linenumber" name="L762" href="#L762">762</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L763" href="#L763">763</a> <em class="jxr_javadoccomment">         * Constructs an &lt;code&gt;IllegalBoundaryException&lt;/code&gt; with no</em>
+<a class="jxr_linenumber" name="L764" href="#L764">764</a> <em class="jxr_javadoccomment">         * detail message.</em>
+<a class="jxr_linenumber" name="L765" href="#L765">765</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L766" href="#L766">766</a>         <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">IllegalBoundaryException</a>() {
+<a class="jxr_linenumber" name="L767" href="#L767">767</a>             <strong class="jxr_keyword">super</strong>();
+<a class="jxr_linenumber" name="L768" href="#L768">768</a>         }
+<a class="jxr_linenumber" name="L769" href="#L769">769</a> 
+<a class="jxr_linenumber" name="L770" href="#L770">770</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L771" href="#L771">771</a> <em class="jxr_javadoccomment">         * Constructs an &lt;code&gt;IllegalBoundaryException&lt;/code&gt; with</em>
+<a class="jxr_linenumber" name="L772" href="#L772">772</a> <em class="jxr_javadoccomment">         * the specified detail message.</em>
+<a class="jxr_linenumber" name="L773" href="#L773">773</a> <em class="jxr_javadoccomment">         *</em>
+<a class="jxr_linenumber" name="L774" href="#L774">774</a> <em class="jxr_javadoccomment">         * @param message The detail message.</em>
+<a class="jxr_linenumber" name="L775" href="#L775">775</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L776" href="#L776">776</a>         <strong class="jxr_keyword">public</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">IllegalBoundaryException</a>(String message) {
+<a class="jxr_linenumber" name="L777" href="#L777">777</a>             <strong class="jxr_keyword">super</strong>(message);
+<a class="jxr_linenumber" name="L778" href="#L778">778</a>         }
+<a class="jxr_linenumber" name="L779" href="#L779">779</a> 
+<a class="jxr_linenumber" name="L780" href="#L780">780</a>     }
+<a class="jxr_linenumber" name="L781" href="#L781">781</a> 
+<a class="jxr_linenumber" name="L782" href="#L782">782</a>     <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L783" href="#L783">783</a> <em class="jxr_javadoccomment">     * An {@link InputStream} for reading an items contents.</em>
+<a class="jxr_linenumber" name="L784" href="#L784">784</a> <em class="jxr_javadoccomment">     */</em>
+<a class="jxr_linenumber" name="L785" href="#L785">785</a>     <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">ItemInputStream</a> <strong class="jxr_keyword">extends</strong> InputStream <strong class="jxr_keyword">implements</strong> <a href="../../../../org/apache/commons/fileupload/util/Closeable.html">Closeable</a> {
+<a class="jxr_linenumber" name="L786" href="#L786">786</a> 
+<a class="jxr_linenumber" name="L787" href="#L787">787</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L788" href="#L788">788</a> <em class="jxr_javadoccomment">         * The number of bytes, which have been read so far.</em>
+<a class="jxr_linenumber" name="L789" href="#L789">789</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L790" href="#L790">790</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">long</strong> total;
+<a class="jxr_linenumber" name="L791" href="#L791">791</a> 
+<a class="jxr_linenumber" name="L792" href="#L792">792</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L793" href="#L793">793</a> <em class="jxr_javadoccomment">         * The number of bytes, which must be hold, because</em>
+<a class="jxr_linenumber" name="L794" href="#L794">794</a> <em class="jxr_javadoccomment">         * they might be a part of the boundary.</em>
+<a class="jxr_linenumber" name="L795" href="#L795">795</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L796" href="#L796">796</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> pad;
+<a class="jxr_linenumber" name="L797" href="#L797">797</a> 
+<a class="jxr_linenumber" name="L798" href="#L798">798</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L799" href="#L799">799</a> <em class="jxr_javadoccomment">         * The current offset in the buffer.</em>
+<a class="jxr_linenumber" name="L800" href="#L800">800</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L801" href="#L801">801</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">int</strong> pos;
+<a class="jxr_linenumber" name="L802" href="#L802">802</a> 
+<a class="jxr_linenumber" name="L803" href="#L803">803</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L804" href="#L804">804</a> <em class="jxr_javadoccomment">         * Whether the stream is already closed.</em>
+<a class="jxr_linenumber" name="L805" href="#L805">805</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L806" href="#L806">806</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">boolean</strong> closed;
+<a class="jxr_linenumber" name="L807" href="#L807">807</a> 
+<a class="jxr_linenumber" name="L808" href="#L808">808</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L809" href="#L809">809</a> <em class="jxr_javadoccomment">         * Creates a new instance.</em>
+<a class="jxr_linenumber" name="L810" href="#L810">810</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L811" href="#L811">811</a>         <a href="../../../../org/apache/commons/fileupload/MultipartStream.html">ItemInputStream</a>() {
+<a class="jxr_linenumber" name="L812" href="#L812">812</a>             findSeparator();
+<a class="jxr_linenumber" name="L813" href="#L813">813</a>         }
+<a class="jxr_linenumber" name="L814" href="#L814">814</a> 
+<a class="jxr_linenumber" name="L815" href="#L815">815</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L816" href="#L816">816</a> <em class="jxr_javadoccomment">         * Called for finding the separator.</em>
+<a class="jxr_linenumber" name="L817" href="#L817">817</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L818" href="#L818">818</a>         <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> findSeparator() {
+<a class="jxr_linenumber" name="L819" href="#L819">819</a>             pos = MultipartStream.<strong class="jxr_keyword">this</strong>.findSeparator();
+<a class="jxr_linenumber" name="L820" href="#L820">820</a>             <strong class="jxr_keyword">if</strong> (pos == -1) {
+<a class="jxr_linenumber" name="L821" href="#L821">821</a>                 <strong class="jxr_keyword">if</strong> (tail - head &gt; keepRegion) {
+<a class="jxr_linenumber" name="L822" href="#L822">822</a>                     pad = keepRegion;
+<a class="jxr_linenumber" name="L823" href="#L823">823</a>                 } <strong class="jxr_keyword">else</strong> {
+<a class="jxr_linenumber" name="L824" href="#L824">824</a>                     pad = tail - head;
+<a class="jxr_linenumber" name="L825" href="#L825">825</a>                 }
+<a class="jxr_linenumber" name="L826" href="#L826">826</a>             }
+<a class="jxr_linenumber" name="L827" href="#L827">827</a>         }
+<a class="jxr_linenumber" name="L828" href="#L828">828</a> 
+<a class="jxr_linenumber" name="L829" href="#L829">829</a>         <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="L830" href="#L830">830</a> <em class="jxr_javadoccomment">         * Returns the number of bytes, which have been read</em>
+<a class="jxr_linenumber" name="L831" href="#L831">831</a> <em class="jxr_javadoccomment">         * by the stream.</em>
+<a class="jxr_linenumber" name="L832" href="#L832">832</a> <em class="jxr_javadoccomment">         *</em>
+<a class="jxr_linenumber" name="L833" href="#L833">833</a> <em class="jxr_javadoccomment">         * @return Number of bytes, which have been read so far.</em>
+<a class="jxr_linenumber" name="L834" href="#L834">834</a> <em class="jxr_javadoccomment">         */</em>
+<a class="jxr_linenumber" name="L835" href="#L835">835</a>         <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">long</strong> getBytesRead() {
+<a class="jxr_linenumber" name="L836" href="#L836">836</a>             <strong class="jxr_keyword">return</strong> total;
+<a class="jxr_linenumber" name="L837" href="#L837">837</a>         }
+<a class="jxr_linenumber" name="L838" href="#L838">838</a> 

[... 197 lines stripped ...]



Mime
View raw message