📄 multipartstream.html
字号:
<!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TD></TR></TABLE><A NAME="MultipartStream(java.io.InputStream, byte[], int)"><!-- --></A><H3>MultipartStream</H3><PRE>public <B>MultipartStream</B>(java.io.InputStream input, byte[] boundary, int bufSize) throws <A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.MalformedStreamException.html">MultipartStream.MalformedStreamException</A>, java.io.IOException</PRE><DL><DD>Constructs a MultipartStream with a custom size buffer. <p>Note that the buffer must be at least big enough to contain the boundary string, plus 4 characters for CR/LF and double dash, plus at least one byte of data. Too small buffer size setting will degrade performance.<DD><DL><DT><B>Parameters:</B><DD><CODE>input</CODE> - The <code>InputStream</code> to serve as a data source.<DD><CODE>boundary</CODE> - The token used for dividing the stream into <code>encapsulations</code>.<DD><CODE>bufSize</CODE> - The size of the buffer to be used in bytes.<DT><B>Throws:</B><DD><CODE>MalformedStreamException.</CODE> - <DD><CODE>IOException.</CODE> - </DL></DD></DL><HR><A NAME="MultipartStream(java.io.InputStream, byte[])"><!-- --></A><H3>MultipartStream</H3><PRE>public <B>MultipartStream</B>(java.io.InputStream input, byte[] boundary) throws java.io.IOException</PRE><DL><DD>Constructs a MultipartStream with a defalut size buffer.<DD><DL><DT><B>Parameters:</B><DD><CODE>input</CODE> - The <code>InputStream</code> to serve as a data source.<DD><CODE>boundary</CODE> - The token used for dividing the stream into <code>encapsulations</code>.<DT><B>Throws:</B><DD><CODE>IOException.</CODE> - </DL></DD></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Method Detail</B></FONT></TD></TR></TABLE><A NAME="readByte()"><!-- --></A><H3>readByte</H3><PRE>public byte <B>readByte</B>() throws java.io.IOException</PRE><DL><DD>Reads a byte from the <code>buffer</code>, and refills it as neccessary.<DD><DL><DT><B>Returns:</B><DD>Next byte from the input stream.<DT><B>Throws:</B><DD><CODE>IOException,</CODE> - if there isn't any more data available.</DL></DD></DL><HR><A NAME="readBoundary()"><!-- --></A><H3>readBoundary</H3><PRE>public boolean <B>readBoundary</B>() throws <A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.MalformedStreamException.html">MultipartStream.MalformedStreamException</A></PRE><DL><DD>Skips a <code>boundary</code> token, and checks wether more <code>encapsulations</code> are contained in the stream.<DD><DL><DT><B>Returns:</B><DD><code>True</code> if there are more encapsulations in this stream.<DT><B>Throws:</B><DD><CODE><A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.MalformedStreamException.html">MultipartStream.MalformedStreamException</A></CODE> - if the stream ends unexpecetedly or fails to follow required syntax.</DL></DD></DL><HR><A NAME="setBoundary(byte[])"><!-- --></A><H3>setBoundary</H3><PRE>public void <B>setBoundary</B>(byte[] boundary) throws <A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.IllegalBoundaryException.html">MultipartStream.IllegalBoundaryException</A></PRE><DL><DD>Changes the boundary token used for partitioning the stream. <p>This method allows single pass processing of nested multipart streams. <p>The boundary token of the nested stream is <code>required</code> to be of the same length as the boundary token in parent stream. <p>Restoring parent stream boundary token after processing of a nested stream is left ot the application. <br><DD><DL><DT><B>Parameters:</B><DD><CODE>boundary</CODE> - A boundary to be used for parsing of the nested stream.<DT><B>Throws:</B><DD><CODE>IllegalBoundaryException,</CODE> - if <code>boundary</code> has diffrent lenght than the one being currently in use.</DL></DD></DL><HR><A NAME="readHeaders()"><!-- --></A><H3>readHeaders</H3><PRE>public java.lang.String <B>readHeaders</B>() throws <A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.MalformedStreamException.html">MultipartStream.MalformedStreamException</A></PRE><DL><DD><p>Reads <code>header-part</code> of the current <code>encapsulation</code> <p>Headers are returned verbatim to the input stream, including traling <code>CRLF</code> marker. Parsing is left to the application. <p><strong>TODO</strong> allow limiting maximum header size to protect against abuse.<br><DD><DL><DT><B>Returns:</B><DD><code>header-part</code> of the current encapsulation.<DT><B>Throws:</B><DD><CODE>MalformedStreamException,</CODE> - if the stream ends unexpecetedly.</DL></DD></DL><HR><A NAME="readBodyData(java.io.OutputStream)"><!-- --></A><H3>readBodyData</H3><PRE>public int <B>readBodyData</B>(java.io.OutputStream output) throws <A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.MalformedStreamException.html">MultipartStream.MalformedStreamException</A>, java.io.IOException</PRE><DL><DD>Reads <code>body-data</code> from the current <code>encapsulation</code> and writes its contents into the output <code>Stream</code>. <p>Arbitrary large amouts of data can be processed by this method using a constant size buffer. (see <A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.html#MultipartStream(java.io.InputStream, byte[], int)"><CODE>constructor</CODE></A>).<DD><DL><DT><B>Parameters:</B><DD><CODE>output</CODE> - The <code>Stream</code> to write data into.<DT><B>Returns:</B><DD>the amount of data written.<DT><B>Throws:</B><DD><CODE><A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.MalformedStreamException.html">MultipartStream.MalformedStreamException</A></CODE> - <DD><CODE>java.io.IOException</CODE> - </DL></DD></DL><HR><A NAME="discardBodyData()"><!-- --></A><H3>discardBodyData</H3><PRE>public int <B>discardBodyData</B>() throws <A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.MalformedStreamException.html">MultipartStream.MalformedStreamException</A>, java.io.IOException</PRE><DL><DD>Reads <code>body-data</code> from the current <code>encapsulation</code> and discards it. <p>Use this method to skip encapsulations you don't need or don't understand.<DD><DL><DT><B>Returns:</B><DD>The amount of data discarded.<DT><B>Throws:</B><DD><CODE><A HREF="../../../../../org/apache/turbine/util/upload/MultipartStream.MalformedStreamException.html">MultipartStream.MalformedStreamException</A></CODE> - <DD><CODE>java.io.IOException</CODE> - </DL></DD></DL><HR><A NAME="skipPreamble()"><!-- --></A><H3>skipPreamble</H3><PRE>public boolean <B>skipPreamble</B>() throws java.io.IOException</PRE><DL><DD>Finds the beginning of the first <code>encapsulation</code>.<DD><DL><DT><B>Returns:</B><DD><code>True</code> if an <code>encapsulation</code> was found in the stream.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - </DL></DD></DL><HR><A NAME="arrayequals(byte[], byte[], int)"><!-- --></A><H3>arrayequals</H3><PRE>public static boolean <B>arrayequals</B>(byte[] a, byte[] b, int count)</PRE><DL><DD>Compares <code>count</code> first bytes in the arrays <code>a</code> and <code>b</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>a</CODE> - The first array to compare.<DD><CODE>b</CODE> - The second array to compare.<DD><CODE>count</CODE> - How many bytes should be compared.<DT><B>Returns:</B><DD><code>true</code> if <code>count</code> first bytes in arrays <code>a</code> and <code>b</code> are equal.</DL></DD></DL><HR><A NAME="findByte(byte, int)"><!-- --></A><H3>findByte</H3><PRE>protected int <B>findByte</B>(byte value, int pos)</PRE><DL><DD>Searches a byte of specified value in the <code>buffer</code> starting at specified <code>position</code>.<DD><DL><DT><B>Parameters:</B><DD><CODE>value</CODE> - the value to find.<DD><CODE>pos</CODE> - The starting position for searching.<DT><B>Returns:</B><DD>The position of byte found, counting from beginning of the <code>buffer</code>, or <code>-1</code> if not found.</DL></DD></DL><HR><A NAME="findSeparator()"><!-- --></A><H3>findSeparator</H3><PRE>protected int <B>findSeparator</B>()</PRE><DL><DD>Searches the <code>boundary</code> in <code>buffer</code> region delimited by <code>head</code> and <code>tail</code>.<DD><DL><DT><B>Returns:</B><DD>The position of the boundary found, counting from beginning of the <code>buffer</code>, or <code>-1</code> if not found.</DL></DD></DL><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/MultipartStream.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../org/apache/turbine/util/upload/FileItem.html"><B>PREV CLASS</B></A> NEXT CLASS</FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../../../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="MultipartStream.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: <A HREF="#inner_class_summary">INNER</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR>Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.</BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -