📄 base64.html
字号:
<DL></DL></DL><HR><A NAME="_ORDERED_DECODABET"><!-- --></A><H3>_ORDERED_DECODABET</H3><PRE>private static final byte[] <B>_ORDERED_DECODABET</B></PRE><DL><DD>Used in decoding the "ordered" dialect of Base64.<P><DL></DL></DL><!-- ========= CONSTRUCTOR DETAIL ======== --><A NAME="constructor_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Constructor Detail</B></FONT></TH></TR></TABLE><A NAME="Base64()"><!-- --></A><H3>Base64</H3><PRE>private <B>Base64</B>()</PRE><DL><DD>Defeats instantiation.<P></DL><!-- ============ METHOD DETAIL ========== --><A NAME="method_detail"><!-- --></A><TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY=""><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2"><B>Method Detail</B></FONT></TH></TR></TABLE><A NAME="getAlphabet(int)"><!-- --></A><H3>getAlphabet</H3><PRE>private static final byte[] <B>getAlphabet</B>(int options)</PRE><DL><DD>Returns one of the _SOMETHING_ALPHABET byte arrays depending on the options specified. It's possible, though silly, to specify ORDERED and URLSAFE in which case one of them will be picked, though there is no guarantee as to which one will be picked.<P><DD><DL></DL></DD></DL><HR><A NAME="getDecodabet(int)"><!-- --></A><H3>getDecodabet</H3><PRE>private static final byte[] <B>getDecodabet</B>(int options)</PRE><DL><DD>Returns one of the _SOMETHING_DECODABET byte arrays depending on the options specified. It's possible, though silly, to specify ORDERED and URL_SAFE in which case one of them will be picked, though there is no guarantee as to which one will be picked.<P><DD><DL></DL></DD></DL><HR><A NAME="main(java.lang.String[])"><!-- --></A><H3>main</H3><PRE>public static final void <B>main</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A>[] args)</PRE><DL><DD>Encodes or decodes two files from the command line; <strong>feel free to delete this method (in fact you probably should) if you're embedding this code into a larger program.</strong><P><DD><DL></DL></DD></DL><HR><A NAME="usage(java.lang.String)"><!-- --></A><H3>usage</H3><PRE>private static final void <B>usage</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> msg)</PRE><DL><DD>Prints command line usage.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>msg</CODE> - A message to include with usage info.</DL></DD></DL><HR><A NAME="encode3to4(byte[], byte[], int, int)"><!-- --></A><H3>encode3to4</H3><PRE>private static byte[] <B>encode3to4</B>(byte[] b4, byte[] threeBytes, int numSigBytes, int options)</PRE><DL><DD>Encodes up to the first three bytes of array <var>threeBytes</var> and returns a four-byte array in Base64 notation. The actual number of significant bytes in your array is given by <var>numSigBytes</var>. The array <var>threeBytes</var> needs only be as big as <var>numSigBytes</var>. Code can reuse a byte array by passing a four-byte array as <var>b4</var>.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>b4</CODE> - A reusable byte array to reduce array instantiation<DD><CODE>threeBytes</CODE> - the array to convert<DD><CODE>numSigBytes</CODE> - the number of significant bytes in your array<DT><B>Returns:</B><DD>four byte array in Base64 notation.<DT><B>Since:</B></DT> <DD>1.5.1</DD></DL></DD></DL><HR><A NAME="encode3to4(byte[], int, int, byte[], int, int)"><!-- --></A><H3>encode3to4</H3><PRE>private static byte[] <B>encode3to4</B>(byte[] source, int srcOffset, int numSigBytes, byte[] destination, int destOffset, int options)</PRE><DL><DD><p>Encodes up to three bytes of the array <var>source</var> and writes the resulting four Base64 bytes to <var>destination</var>. The source and destination arrays can be manipulated anywhere along their length by specifying <var>srcOffset</var> and <var>destOffset</var>. This method does not check to make sure your arrays are large enough to accomodate <var>srcOffset</var> + 3 for the <var>source</var> array or <var>destOffset</var> + 4 for the <var>destination</var> array. The actual number of significant bytes in your array is given by <var>numSigBytes</var>.</p> <p>This is the lowest level of the encoding methods with all possible parameters.</p><P><DD><DL><DT><B>Parameters:</B><DD><CODE>source</CODE> - the array to convert<DD><CODE>srcOffset</CODE> - the index where conversion begins<DD><CODE>numSigBytes</CODE> - the number of significant bytes in your array<DD><CODE>destination</CODE> - the array to hold the conversion<DD><CODE>destOffset</CODE> - the index where output will be put<DT><B>Returns:</B><DD>the <var>destination</var> array<DT><B>Since:</B></DT> <DD>1.3</DD></DL></DD></DL><HR><A NAME="encodeObject(java.io.Serializable)"><!-- --></A><H3>encodeObject</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeObject</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</A> serializableObject)</PRE><DL><DD>Serializes an object and returns the Base64-encoded version of that serialized object. If the object cannot be serialized or there is another error, the method will return <tt>null</tt>. The object is not GZip-compressed before being encoded.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>serializableObject</CODE> - The object to encode<DT><B>Returns:</B><DD>The Base64-encoded object<DT><B>Since:</B></DT> <DD>1.4</DD></DL></DD></DL><HR><A NAME="encodeObject(java.io.Serializable, int)"><!-- --></A><H3>encodeObject</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeObject</B>(<A HREF="http://java.sun.com/j2se/1.4/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io">Serializable</A> serializableObject, int options)</PRE><DL><DD>Serializes an object and returns the Base64-encoded version of that serialized object. If the object cannot be serialized or there is another error, the method will return <tt>null</tt>. <p> Valid options:<pre> GZIP: gzip-compresses object before encoding it. DONT_BREAK_LINES: don't break lines at 76 characters <i>Note: Technically, this makes your encoding non-compliant.</i> </pre> <p> Example: <code>encodeObject( myObj, Base64.GZIP )</code> or <p> Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DONT_BREAK_LINES )</code><P><DD><DL><DT><B>Parameters:</B><DD><CODE>serializableObject</CODE> - The object to encode<DD><CODE>options</CODE> - Specified options<DT><B>Returns:</B><DD>The Base64-encoded object<DT><B>Since:</B></DT> <DD>2.0</DD><DT><B>See Also:</B><DD><A HREF="../../../../../com/lowagie/text/pdf/codec/Base64.html#GZIP"><CODE>GZIP</CODE></A>, <A HREF="../../../../../com/lowagie/text/pdf/codec/Base64.html#DONT_BREAK_LINES"><CODE>DONT_BREAK_LINES</CODE></A></DL></DD></DL><HR><A NAME="encodeBytes(byte[])"><!-- --></A><H3>encodeBytes</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeBytes</B>(byte[] source)</PRE><DL><DD>Encodes a byte array into Base64 notation. Does not GZip-compress data.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>source</CODE> - The data to convert<DT><B>Since:</B></DT> <DD>1.4</DD></DL></DD></DL><HR><A NAME="encodeBytes(byte[], int)"><!-- --></A><H3>encodeBytes</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeBytes</B>(byte[] source, int options)</PRE><DL><DD>Encodes a byte array into Base64 notation. <p> Valid options:<pre> GZIP: gzip-compresses object before encoding it. DONT_BREAK_LINES: don't break lines at 76 characters <i>Note: Technically, this makes your encoding non-compliant.</i> </pre> <p> Example: <code>encodeBytes( myData, Base64.GZIP )</code> or <p> Example: <code>encodeBytes( myData, Base64.GZIP | Base64.DONT_BREAK_LINES )</code><P><DD><DL><DT><B>Parameters:</B><DD><CODE>source</CODE> - The data to convert<DD><CODE>options</CODE> - Specified options<DT><B>Since:</B></DT> <DD>2.0</DD><DT><B>See Also:</B><DD><A HREF="../../../../../com/lowagie/text/pdf/codec/Base64.html#GZIP"><CODE>GZIP</CODE></A>, <A HREF="../../../../../com/lowagie/text/pdf/codec/Base64.html#DONT_BREAK_LINES"><CODE>DONT_BREAK_LINES</CODE></A></DL></DD></DL><HR><A NAME="encodeBytes(byte[], int, int)"><!-- --></A><H3>encodeBytes</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeBytes</B>(byte[] source, int off, int len)</PRE><DL><DD>Encodes a byte array into Base64 notation. Does not GZip-compress data.<P><DD><DL><DT><B>Parameters:</B><DD><CODE>source</CODE> - The data to convert<DD><CODE>off</CODE> - Offset in array where conversion should begin<DD><CODE>len</CODE> - Length of data to convert<DT><B>Since:</B></DT> <DD>1.4</DD></DL></DD></DL><HR><A NAME="encodeBytes(byte[], int, int, int)"><!-- --></A><H3>encodeBytes</H3><PRE>public static <A HREF="http://java.sun.com/j2se/1.4/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeBytes</B>(byte[] source, int off, int len, int options)</PRE><DL><DD>Encodes a byte array into Base64 notation. <p> Valid options:<pre>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -