Edit D:\app\Administrator\product\11.2.0\dbhome_1\owb\lib\int\HTTPClient\doc\api\HTTPClient\Codecs.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc on Mon May 07 18:52:24 PDT 2001 --> <TITLE> HTTPClient API: Class Codecs </TITLE> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> </HEAD> <BODY BGCOLOR="white"> <!-- ========== START OF NAVBAR ========== --> <A NAME="navbar_top"><!-- --></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_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 ID="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="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="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT ID="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="../HTTPClient/AuthorizationInfo.html"><B>PREV CLASS</B></A> <A HREF="../HTTPClient/Cookie.html"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Codecs.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> <!-- ======== START OF CLASS DATA ======== --> <H2> <FONT SIZE="-1"> HTTPClient</FONT> <BR> Class Codecs</H2> <PRE> <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html">java.lang.Object</A> | +--<B>HTTPClient.Codecs</B> </PRE> <HR> <DL> <DT>public class <B>Codecs</B><DT>extends <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html">Object</A></DL> <P> This class collects various encoders and decoders. <P> <DL> <DT><B>Version: </B><DD>0.3-3 06/05/2001</DD> <DT><B>Author: </B><DD>Ronald Tschal?</DD> </DL> <HR> <P> <!-- ======== INNER CLASS SUMMARY ======== --> <!-- =========== FIELD SUMMARY =========== --> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <!-- ========== METHOD SUMMARY =========== --> <A NAME="method_summary"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"> <TD COLSPAN=2><FONT SIZE="+2"> <B>Method Summary</B></FONT></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#base64Decode(byte[])">base64Decode</A></B>(byte[] data)</CODE> <BR> This method decodes the given byte[] using the base64-encoding specified in RFC-2045 (Section 6.8).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#base64Decode(java.lang.String)">base64Decode</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</CODE> <BR> This method decodes the given string using the base64-encoding specified in RFC-2045 (Section 6.8).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#base64Encode(byte[])">base64Encode</A></B>(byte[] data)</CODE> <BR> This method encodes the given byte[] using the base64-encoding specified in RFC-2045 (Section 6.8).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#base64Encode(java.lang.String)">base64Encode</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</CODE> <BR> This method encodes the given string using the base64-encoding specified in RFC-2045 (Section 6.8).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html">Object</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#chunkedDecode(java.io.InputStream)">chunkedDecode</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/InputStream.html">InputStream</A> input)</CODE> <BR> Decodes chunked data.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#chunkedEncode(byte[], int, int, HTTPClient.NVPair[], boolean)">chunkedEncode</A></B>(byte[] data, int off, int len, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] ftrs, boolean last)</CODE> <BR> Encodes data used the chunked encoding.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#chunkedEncode(byte[], HTTPClient.NVPair[], boolean)">chunkedEncode</A></B>(byte[] data, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] ftrs, boolean last)</CODE> <BR> Encodes data used the chunked encoding.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../HTTPClient/NVPair.html">NVPair</A>[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#mpFormDataDecode(byte[], java.lang.String, java.lang.String)">mpFormDataDecode</A></B>(byte[] data, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> cont_type, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> dir)</CODE> <BR> This method decodes a multipart/form-data encoded string.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../HTTPClient/NVPair.html">NVPair</A>[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#mpFormDataDecode(byte[], java.lang.String, java.lang.String, HTTPClient.FilenameMangler)">mpFormDataDecode</A></B>(byte[] data, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> cont_type, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> dir, <A HREF="../HTTPClient/FilenameMangler.html">FilenameMangler</A> mangler)</CODE> <BR> This method decodes a multipart/form-data encoded string.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#mpFormDataEncode(HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.NVPair[])">mpFormDataEncode</A></B>(<A HREF="../HTTPClient/NVPair.html">NVPair</A>[] opts, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] files, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] ct_hdr)</CODE> <BR> This method encodes name/value pairs and files into a byte array using the multipart/form-data encoding.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#mpFormDataEncode(HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.FilenameMangler)">mpFormDataEncode</A></B>(<A HREF="../HTTPClient/NVPair.html">NVPair</A>[] opts, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] files, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] ct_hdr, <A HREF="../HTTPClient/FilenameMangler.html">FilenameMangler</A> mangler)</CODE> <BR> This method encodes name/value pairs and files into a byte array using the multipart/form-data encoding.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#nv2query(HTTPClient.NVPair[])">nv2query</A></B>(<A HREF="../HTTPClient/NVPair.html">NVPair</A>[] pairs)</CODE> <BR> Turns an array of name/value pairs into the string "name1=value1&name2=value2&name3=value3".</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="../HTTPClient/NVPair.html">NVPair</A>[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#query2nv(java.lang.String)">query2nv</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> query)</CODE> <BR> Turns a string of the form "name1=value1&name2=value2&name3=value3" into an array of name/value pairs.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#quotedPrintableDecode(java.lang.String)">quotedPrintableDecode</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</CODE> <BR> This method does a quoted-printable decoding of the given string according to RFC-2045 (Section 6.7).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#quotedPrintableEncode(java.lang.String)">quotedPrintableEncode</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</CODE> <BR> This method does a quoted-printable encoding of the given string according to RFC-2045 (Section 6.7).</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#URLDecode(java.lang.String)">URLDecode</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</CODE> <BR> This method decodes the given urlencoded string.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A></CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#URLEncode(java.lang.String)">URLEncode</A></B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</CODE> <BR> This method urlencodes the given string.</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static byte[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#uudecode(char[])">uudecode</A></B>(char[] data)</CODE> <BR> This method decodes the given uuencoded char[].</TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"> <CODE>static char[]</CODE></FONT></TD> <TD><CODE><B><A HREF="../HTTPClient/Codecs.html#uuencode(byte[])">uuencode</A></B>(byte[] data)</CODE> <BR> This method encodes the given byte[] using the unix uuencode encding.</TD> </TR> </TABLE> <A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A> <TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"> <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"> <TD><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html">Object</A></B></TD> </TR> <TR BGCOLOR="white" CLASS="TableRowColor"> <TD><CODE><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#clone()">clone</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#finalize()">finalize</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#getClass()">getClass</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#notify()">notify</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#toString()">toString</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#wait()">wait</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#wait(long)">wait</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html#wait(long, int)">wait</A></CODE></TD> </TR> </TABLE> <P> <!-- ============ FIELD DETAIL =========== --> <!-- ========= CONSTRUCTOR DETAIL ======== --> <!-- ============ 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="base64Encode(java.lang.String)"><!-- --></A><H3> base64Encode</H3> <PRE> public static final <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>base64Encode</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</PRE> <DL> <DD>This method encodes the given string using the base64-encoding specified in RFC-2045 (Section 6.8). It's used for example in the "Basic" authorization scheme.<DD><DL> <DT><B>Parameters:</B><DD><CODE>str</CODE> - the string<DT><B>Returns:</B><DD>the base64-encoded <var>str</var></DL> </DD> </DL> <HR> <A NAME="base64Encode(byte[])"><!-- --></A><H3> base64Encode</H3> <PRE> public static final byte[] <B>base64Encode</B>(byte[] data)</PRE> <DL> <DD>This method encodes the given byte[] using the base64-encoding specified in RFC-2045 (Section 6.8).<DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the data<DT><B>Returns:</B><DD>the base64-encoded <var>data</var></DL> </DD> </DL> <HR> <A NAME="base64Decode(java.lang.String)"><!-- --></A><H3> base64Decode</H3> <PRE> public static final <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>base64Decode</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</PRE> <DL> <DD>This method decodes the given string using the base64-encoding specified in RFC-2045 (Section 6.8).<DD><DL> <DT><B>Parameters:</B><DD><CODE>str</CODE> - the base64-encoded string.<DT><B>Returns:</B><DD>the decoded <var>str</var>.</DL> </DD> </DL> <HR> <A NAME="base64Decode(byte[])"><!-- --></A><H3> base64Decode</H3> <PRE> public static final byte[] <B>base64Decode</B>(byte[] data)</PRE> <DL> <DD>This method decodes the given byte[] using the base64-encoding specified in RFC-2045 (Section 6.8).<DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the base64-encoded data.<DT><B>Returns:</B><DD>the decoded <var>data</var>.</DL> </DD> </DL> <HR> <A NAME="uuencode(byte[])"><!-- --></A><H3> uuencode</H3> <PRE> public static final char[] <B>uuencode</B>(byte[] data)</PRE> <DL> <DD>This method encodes the given byte[] using the unix uuencode encding. The output is split into lines starting with the encoded number of encoded octets in the line and ending with a newline. No line is longer than 45 octets (60 characters), not including length and newline. <P><em>Note:</em> just the raw data is encoded; no 'begin' and 'end' lines are added as is done by the unix <code>uuencode</code> utility.<DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the data<DT><B>Returns:</B><DD>the uuencoded <var>data</var></DL> </DD> </DL> <HR> <A NAME="uudecode(char[])"><!-- --></A><H3> uudecode</H3> <PRE> public static final byte[] <B>uudecode</B>(char[] data)</PRE> <DL> <DD>This method decodes the given uuencoded char[]. <P><em>Note:</em> just the actual data is decoded; any 'begin' and 'end' lines such as those generated by the unix <code>uuencode</code> utility must not be included.<DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the uuencode-encoded data.<DT><B>Returns:</B><DD>the decoded <var>data</var>.</DL> </DD> </DL> <HR> <A NAME="quotedPrintableEncode(java.lang.String)"><!-- --></A><H3> quotedPrintableEncode</H3> <PRE> public static final <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>quotedPrintableEncode</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</PRE> <DL> <DD>This method does a quoted-printable encoding of the given string according to RFC-2045 (Section 6.7). <em>Note:</em> this assumes 8-bit characters.<DD><DL> <DT><B>Parameters:</B><DD><CODE>str</CODE> - the string<DT><B>Returns:</B><DD>the quoted-printable encoded string</DL> </DD> </DL> <HR> <A NAME="quotedPrintableDecode(java.lang.String)"><!-- --></A><H3> quotedPrintableDecode</H3> <PRE> public static final <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>quotedPrintableDecode</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str) throws <A HREF="../HTTPClient/ParseException.html">ParseException</A></PRE> <DL> <DD>This method does a quoted-printable decoding of the given string according to RFC-2045 (Section 6.7). <em>Note:</em> this method expects the whole message in one chunk, not line by line.<DD><DL> <DT><B>Parameters:</B><DD><CODE>str</CODE> - the message<DT><B>Returns:</B><DD>the decoded message<DT><B>Throws:</B><DD><A HREF="../HTTPClient/ParseException.html">ParseException</A> - If a '=' is not followed by a valid 2-digit hex number or '\r\n'.</DL> </DD> </DL> <HR> <A NAME="URLEncode(java.lang.String)"><!-- --></A><H3> URLEncode</H3> <PRE> public static final <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>URLEncode</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str)</PRE> <DL> <DD>This method urlencodes the given string. This method is here for symmetry reasons and just calls java.net.URLEncoder.encode().<DD><DL> <DT><B>Parameters:</B><DD><CODE>str</CODE> - the string<DT><B>Returns:</B><DD>the url-encoded string</DL> </DD> </DL> <HR> <A NAME="URLDecode(java.lang.String)"><!-- --></A><H3> URLDecode</H3> <PRE> public static final <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>URLDecode</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> str) throws <A HREF="../HTTPClient/ParseException.html">ParseException</A></PRE> <DL> <DD>This method decodes the given urlencoded string.<DD><DL> <DT><B>Parameters:</B><DD><CODE>str</CODE> - the url-encoded string<DT><B>Returns:</B><DD>the decoded string<DT><B>Throws:</B><DD><A HREF="../HTTPClient/ParseException.html">ParseException</A> - If a '%' is not followed by a valid 2-digit hex number.</DL> </DD> </DL> <HR> <A NAME="mpFormDataDecode(byte[], java.lang.String, java.lang.String)"><!-- --></A><H3> mpFormDataDecode</H3> <PRE> public static final <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] <B>mpFormDataDecode</B>(byte[] data, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> cont_type, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> dir) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A>, <A HREF="../HTTPClient/ParseException.html">ParseException</A></PRE> <DL> <DD>This method decodes a multipart/form-data encoded string.<DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the form-data to decode.<DD><CODE>cont_type</CODE> - the content type header (must contain the boundary string).<DD><CODE>dir</CODE> - the directory to create the files in.<DT><B>Returns:</B><DD>an array of name/value pairs, one for each part; the name is the 'name' attribute given in the Content-Disposition header; the value is either the name of the file if a filename attribute was found, or the contents of the part.<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - If any file operation fails.<DD><A HREF="../HTTPClient/ParseException.html">ParseException</A> - If an error during parsing occurs.<DT><B>See Also: </B><DD><A HREF="../HTTPClient/Codecs.html#mpFormDataDecode(byte[], java.lang.String, java.lang.String, HTTPClient.FilenameMangler)"><CODE>mpFormDataDecode(byte[], java.lang.String, java.lang.String, HTTPClient.FilenameMangler)</CODE></A></DL> </DD> </DL> <HR> <A NAME="mpFormDataDecode(byte[], java.lang.String, java.lang.String, HTTPClient.FilenameMangler)"><!-- --></A><H3> mpFormDataDecode</H3> <PRE> public static final <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] <B>mpFormDataDecode</B>(byte[] data, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> cont_type, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> dir, <A HREF="../HTTPClient/FilenameMangler.html">FilenameMangler</A> mangler) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A>, <A HREF="../HTTPClient/ParseException.html">ParseException</A></PRE> <DL> <DD>This method decodes a multipart/form-data encoded string. The boundary is parsed from the <var>cont_type</var> parameter, which must be of the form 'multipart/form-data; boundary=...'. Any encoded files are created in the directory specified by <var>dir</var> using the encoded filename. <P><em>Note:</em> Does not handle nested encodings (yet). <P>Examples: If you're receiving a multipart/form-data encoded response from a server you could use something like: <PRE> NVPair[] opts = Codecs.mpFormDataDecode(resp.getData(), resp.getHeader("Content-type"), "."); </PRE> If you're using this in a Servlet to decode the body of a request from a client you could use something like: <PRE> byte[] body = new byte[req.getContentLength()]; new DataInputStream(req.getInputStream()).readFully(body); NVPair[] opts = Codecs.mpFormDataDecode(body, req.getContentType(), "."); </PRE> (where 'req' is the HttpServletRequest). <P>Assuming the data received looked something like: <PRE> -----------------------------114975832116442893661388290519 Content-Disposition: form-data; name="option" doit -----------------------------114975832116442893661388290519 Content-Disposition: form-data; name="comment"; filename="comment.txt" Gnus and Gnats are not Gnomes. -----------------------------114975832116442893661388290519-- </PRE> you would get one file called <VAR>comment.txt</VAR> in the current directory, and opts would contain two elements: {"option", "doit"} and {"comment", "comment.txt"}<DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the form-data to decode.<DD><CODE>cont_type</CODE> - the content type header (must contain the boundary string).<DD><CODE>dir</CODE> - the directory to create the files in.<DD><CODE>mangler</CODE> - the filename mangler, or null if no mangling is to be done. This is invoked just before each file is created and written, thereby allowing you to control the names of the files.<DT><B>Returns:</B><DD>an array of name/value pairs, one for each part; the name is the 'name' attribute given in the Content-Disposition header; the value is either the name of the file if a filename attribute was found, or the contents of the part.<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - If any file operation fails.<DD><A HREF="../HTTPClient/ParseException.html">ParseException</A> - If an error during parsing occurs.</DL> </DD> </DL> <HR> <A NAME="mpFormDataEncode(HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.NVPair[])"><!-- --></A><H3> mpFormDataEncode</H3> <PRE> public static final byte[] <B>mpFormDataEncode</B>(<A HREF="../HTTPClient/NVPair.html">NVPair</A>[] opts, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] files, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] ct_hdr) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>This method encodes name/value pairs and files into a byte array using the multipart/form-data encoding.<DD><DL> <DT><B>Parameters:</B><DD><CODE>opts</CODE> - the simple form-data to encode (may be null); for each NVPair the name refers to the 'name' attribute to be used in the header of the part, and the value is contents of the part.<DD><CODE>files</CODE> - the files to encode (may be null); for each NVPair the name refers to the 'name' attribute to be used in the header of the part, and the value is the actual filename (the file will be read and it's contents put in the body of that part).<DD><CODE>ct_hdr</CODE> - this returns a new NVPair in the 0'th element which contains name = "Content-Type", value = "multipart/form-data; boundary=..." (the reason this parameter is an array is because a) that's the only way to simulate pass-by-reference and b) you need an array for the headers parameter to the Post() or Put() anyway).<DT><B>Returns:</B><DD>an encoded byte array containing all the opts and files.<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - If any file operation fails.<DT><B>See Also: </B><DD><A HREF="../HTTPClient/Codecs.html#mpFormDataEncode(HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.FilenameMangler)"><CODE>mpFormDataEncode(HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.FilenameMangler)</CODE></A></DL> </DD> </DL> <HR> <A NAME="mpFormDataEncode(HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.NVPair[], HTTPClient.FilenameMangler)"><!-- --></A><H3> mpFormDataEncode</H3> <PRE> public static final byte[] <B>mpFormDataEncode</B>(<A HREF="../HTTPClient/NVPair.html">NVPair</A>[] opts, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] files, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] ct_hdr, <A HREF="../HTTPClient/FilenameMangler.html">FilenameMangler</A> mangler) throws <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>This method encodes name/value pairs and files into a byte array using the multipart/form-data encoding. The boundary is returned as part of <var>ct_hdr</var>. <BR>Example: <PRE> NVPair[] opts = { new NVPair("option", "doit") }; NVPair[] file = { new NVPair("comment", "comment.txt") }; NVPair[] hdrs = new NVPair[1]; byte[] data = Codecs.mpFormDataEncode(opts, file, hdrs); con.Post("/cgi-bin/handle-it", data, hdrs); </PRE> <VAR>data</VAR> will look something like the following: <PRE> -----------------------------114975832116442893661388290519 Content-Disposition: form-data; name="option" doit -----------------------------114975832116442893661388290519 Content-Disposition: form-data; name="comment"; filename="comment.txt" Content-Type: text/plain Gnus and Gnats are not Gnomes. -----------------------------114975832116442893661388290519-- </PRE> where the "Gnus and Gnats ..." is the contents of the file <VAR>comment.txt</VAR> in the current directory. <P>If no elements are found in the parameters then a zero-length byte[] is returned and the content-type is set to <var>application/octet-string</var> (because a multipart must always have at least one part. <P>For files an attempt is made to discover the content-type, and if found a Content-Type header will be added to that part. The content type is retrieved using java.net.URLConnection.guessContentTypeFromName() - see java.net.URLConnection.setFileNameMap() for how to modify that map. Note that under JDK 1.1 by default the map seems to be empty. If you experience troubles getting the server to accept the data then make sure the fileNameMap is returning a content-type for each file (this may mean you'll have to set your own).<DD><DL> <DT><B>Parameters:</B><DD><CODE>opts</CODE> - the simple form-data to encode (may be null); for each NVPair the name refers to the 'name' attribute to be used in the header of the part, and the value is contents of the part. null elements in the array are ingored.<DD><CODE>files</CODE> - the files to encode (may be null); for each NVPair the name refers to the 'name' attribute to be used in the header of the part, and the value is the actual filename (the file will be read and it's contents put in the body of that part). null elements in the array are ingored.<DD><CODE>ct_hdr</CODE> - this returns a new NVPair in the 0'th element which contains name = "Content-Type", value = "multipart/form-data; boundary=..." (the reason this parameter is an array is because a) that's the only way to simulate pass-by-reference and b) you need an array for the headers parameter to the Post() or Put() anyway). The exception to this is that if no opts or files are given the type is set to "application/octet-stream" instead.<DD><CODE>mangler</CODE> - the filename mangler, or null if no mangling is to be done. This allows you to change the name used in the <var>filename</var> attribute of the Content-Disposition header. Note: the mangler will be invoked twice for each filename.<DT><B>Returns:</B><DD>an encoded byte array containing all the opts and files.<DT><B>Throws:</B><DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - If any file operation fails.</DL> </DD> </DL> <HR> <A NAME="nv2query(HTTPClient.NVPair[])"><!-- --></A><H3> nv2query</H3> <PRE> public static final <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> <B>nv2query</B>(<A HREF="../HTTPClient/NVPair.html">NVPair</A>[] pairs)</PRE> <DL> <DD>Turns an array of name/value pairs into the string "name1=value1&name2=value2&name3=value3". The names and values are first urlencoded. This is the form in which form-data is passed to a cgi script.<DD><DL> <DT><B>Parameters:</B><DD><CODE>pairs</CODE> - the array of name/value pairs<DT><B>Returns:</B><DD>a string containg the encoded name/value pairs</DL> </DD> </DL> <HR> <A NAME="query2nv(java.lang.String)"><!-- --></A><H3> query2nv</H3> <PRE> public static final <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] <B>query2nv</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/String.html">String</A> query) throws <A HREF="../HTTPClient/ParseException.html">ParseException</A></PRE> <DL> <DD>Turns a string of the form "name1=value1&name2=value2&name3=value3" into an array of name/value pairs. The names and values are urldecoded. The query string is in the form in which form-data is received in a cgi script.<DD><DL> <DT><B>Parameters:</B><DD><CODE>query</CODE> - the query string containing the encoded name/value pairs<DT><B>Returns:</B><DD>an array of NVPairs<DT><B>Throws:</B><DD><A HREF="../HTTPClient/ParseException.html">ParseException</A> - If the '=' is missing in any field, or if the urldecoding of the name or value fails</DL> </DD> </DL> <HR> <A NAME="chunkedEncode(byte[], HTTPClient.NVPair[], boolean)"><!-- --></A><H3> chunkedEncode</H3> <PRE> public static final byte[] <B>chunkedEncode</B>(byte[] data, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] ftrs, boolean last)</PRE> <DL> <DD>Encodes data used the chunked encoding. <var>last</var> signales if this is the last chunk, in which case the appropriate footer is generated.<DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the data to be encoded; may be null.<DD><CODE>ftrs</CODE> - optional headers to include in the footer (ignored if not last); may be null.<DD><CODE>last</CODE> - whether this is the last chunk.<DT><B>Returns:</B><DD>an array of bytes containing the chunk</DL> </DD> </DL> <HR> <A NAME="chunkedEncode(byte[], int, int, HTTPClient.NVPair[], boolean)"><!-- --></A><H3> chunkedEncode</H3> <PRE> public static final byte[] <B>chunkedEncode</B>(byte[] data, int off, int len, <A HREF="../HTTPClient/NVPair.html">NVPair</A>[] ftrs, boolean last)</PRE> <DL> <DD>Encodes data used the chunked encoding. <var>last</var> signales if this is the last chunk, in which case the appropriate footer is generated.<DD><DL> <DT><B>Parameters:</B><DD><CODE>data</CODE> - the data to be encoded; may be null.<DD><CODE>off</CODE> - an offset into the <var>data</var><DD><CODE>len</CODE> - the number of bytes to take from <var>data</var><DD><CODE>ftrs</CODE> - optional headers to include in the footer (ignored if not last); may be null.<DD><CODE>last</CODE> - whether this is the last chunk.<DT><B>Returns:</B><DD>an array of bytes containing the chunk</DL> </DD> </DL> <HR> <A NAME="chunkedDecode(java.io.InputStream)"><!-- --></A><H3> chunkedDecode</H3> <PRE> public static final <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/lang/Object.html">Object</A> <B>chunkedDecode</B>(<A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/InputStream.html">InputStream</A> input) throws <A HREF="../HTTPClient/ParseException.html">ParseException</A>, <A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A></PRE> <DL> <DD>Decodes chunked data. The chunks are read from an InputStream, which is assumed to be correctly positioned. Use 'xxx instanceof byte[]' and 'xxx instanceof NVPair[]' to determine if this was data or the last chunk.<DD><DL> <DT><B>Parameters:</B><DD><CODE>input</CODE> - the stream from which to read the next chunk.<DT><B>Returns:</B><DD>If this was a data chunk then it returns a byte[]; else it's the footer and it returns a NVPair[] containing the footers.<DT><B>Throws:</B><DD><A HREF="../HTTPClient/ParseException.html">ParseException</A> - If any exception during parsing occured.<DD><A HREF="http://java.sun.com/products/jdk/1.2/docs/api/java/io/IOException.html">IOException</A> - If any exception during reading occured.</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 ID="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT ID="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="package-tree.html"><FONT ID="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT ID="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../index-all.html"><FONT ID="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT ID="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="../HTTPClient/AuthorizationInfo.html"><B>PREV CLASS</B></A> <A HREF="../HTTPClient/Cookie.html"><B>NEXT CLASS</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Codecs.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD> </TR> <TR> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD> <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD> </TR> </TABLE> <!-- =========== END OF NAVBAR =========== --> <HR> </BODY> </HTML>
Ms-Dos/Windows
Unix
Write backup
jsp File Browser version 1.2 by
www.vonloesch.de