532 lines
27 KiB
HTML
532 lines
27 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
<!--NewPage-->
|
|
<HTML>
|
|
<HEAD>
|
|
<!-- Generated by javadoc (build 1.6.0_26) on Sat Sep 22 16:55:25 CEST 2012 -->
|
|
<TITLE>
|
|
mxBase64 (mxGraph 1.10.3.1 API Specification)
|
|
</TITLE>
|
|
|
|
<META NAME="date" CONTENT="2012-09-22">
|
|
|
|
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
|
|
|
|
<SCRIPT type="text/javascript">
|
|
function windowTitle()
|
|
{
|
|
if (location.href.indexOf('is-external=true') == -1) {
|
|
parent.document.title="mxBase64 (mxGraph 1.10.3.1 API Specification)";
|
|
}
|
|
}
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
</NOSCRIPT>
|
|
|
|
</HEAD>
|
|
|
|
<BODY BGCOLOR="white" onload="windowTitle();">
|
|
<HR>
|
|
|
|
|
|
<!-- ========= START OF TOP NAVBAR ======= -->
|
|
<A NAME="navbar_top"><!-- --></A>
|
|
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_top_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<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/mxBase64.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>
|
|
<p><b>mxGraph 1.10.3.1</b></p></EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
PREV CLASS
|
|
<A HREF="../../../com/mxgraph/util/mxCellRenderer.html" title="class in com.mxgraph.util"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../index.html?com/mxgraph/util/mxBase64.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="mxBase64.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_top"></A>
|
|
<!-- ========= END OF TOP NAVBAR ========= -->
|
|
|
|
<HR>
|
|
<!-- ======== START OF CLASS DATA ======== -->
|
|
<H2>
|
|
<FONT SIZE="-1">
|
|
com.mxgraph.util</FONT>
|
|
<BR>
|
|
Class mxBase64</H2>
|
|
<PRE>
|
|
<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
|
|
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.mxgraph.util.mxBase64</B>
|
|
</PRE>
|
|
<HR>
|
|
<DL>
|
|
<DT><PRE>public class <B>mxBase64</B><DT>extends <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></DL>
|
|
</PRE>
|
|
|
|
<P>
|
|
A very fast and memory efficient class to encode and decode to and from BASE64 in full accordance
|
|
with RFC 2045.<br><br>
|
|
On Windows XP sp1 with 1.4.2_04 and later ;), this encoder and decoder is about 10 times faster
|
|
on small arrays (10 - 1000 bytes) and 2-3 times as fast on larger arrays (10000 - 1000000 bytes)
|
|
compared to <code>sun.misc.Encoder()/Decoder()</code>.<br><br>
|
|
|
|
On byte arrays the encoder is about 20% faster than Jakarta Commons Base64 Codec for encode and
|
|
about 50% faster for decoding large arrays. This implementation is about twice as fast on very small
|
|
arrays (< 30 bytes). If source/destination is a <code>String</code> this
|
|
version is about three times as fast due to the fact that the Commons Codec result has to be recoded
|
|
to a <code>String</code> from <code>byte[]</code>, which is very expensive.<br><br>
|
|
|
|
This encode/decode algorithm doesn't create any temporary arrays as many other codecs do, it only
|
|
allocates the resulting array. This produces less garbage and it is possible to handle arrays twice
|
|
as large as algorithms that create a temporary array. (E.g. Jakarta Commons Codec). It is unknown
|
|
whether Sun's <code>sun.misc.Encoder()/Decoder()</code> produce temporary arrays but since performance
|
|
is quite low it probably does.<br><br>
|
|
|
|
The encoder produces the same output as the Sun one except that the Sun's encoder appends
|
|
a trailing line separator if the last character isn't a pad. Unclear why but it only adds to the
|
|
length and is probably a side effect. Both are in conformance with RFC 2045 though.<br>
|
|
Commons codec seem to always att a trailing line separator.<br><br>
|
|
|
|
<b>Note!</b>
|
|
The encode/decode method pairs (types) come in three versions with the <b>exact</b> same algorithm and
|
|
thus a lot of code redundancy. This is to not create any temporary arrays for transcoding to/from different
|
|
format types. The methods not used can simply be commented out.<br><br>
|
|
|
|
There is also a "fast" version of all decode methods that works the same way as the normal ones, but
|
|
har a few demands on the decoded input. Normally though, these fast verions should be used if the source if
|
|
the input is known and it hasn't bee tampered with.<br><br>
|
|
|
|
If you find the code useful or you find a bug, please send me a note at base64 @ miginfocom . com.
|
|
|
|
Licence (BSD):
|
|
==============
|
|
|
|
Copyright (c) 2004, Mikael Grev, MiG InfoCom AB. (base64 @ miginfocom . com)
|
|
All rights reserved.
|
|
|
|
Redistribution and use in source and binary forms, with or without modification,
|
|
are permitted provided that the following conditions are met:
|
|
Redistributions of source code must retain the above copyright notice, this list
|
|
of conditions and the following disclaimer.
|
|
Redistributions in binary form must reproduce the above copyright notice, this
|
|
list of conditions and the following disclaimer in the documentation and/or other
|
|
materials provided with the distribution.
|
|
Neither the name of the MiG InfoCom AB nor the names of its contributors may be
|
|
used to endorse or promote products derived from this software without specific
|
|
prior written permission.
|
|
|
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
|
|
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
|
|
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
|
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
|
OF SUCH DAMAGE.
|
|
<P>
|
|
|
|
<P>
|
|
<HR>
|
|
|
|
<P>
|
|
|
|
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
|
|
|
|
<A NAME="constructor_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Constructor Summary</B></FONT></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><B><A HREF="../../../com/mxgraph/util/mxBase64.html#mxBase64()">mxBase64</A></B>()</CODE>
|
|
|
|
<BR>
|
|
</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- ========== METHOD SUMMARY =========== -->
|
|
|
|
<A NAME="method_summary"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
|
|
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
|
|
<B>Method Summary</B></FONT></TH>
|
|
</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="../../../com/mxgraph/util/mxBase64.html#decode(byte[])">decode</A></B>(byte[] sArr)</CODE>
|
|
|
|
<BR>
|
|
Decodes a BASE64 encoded byte array.</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="../../../com/mxgraph/util/mxBase64.html#decode(char[])">decode</A></B>(char[] sArr)</CODE>
|
|
|
|
<BR>
|
|
Decodes a BASE64 encoded char array.</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="../../../com/mxgraph/util/mxBase64.html#decode(java.lang.String)">decode</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> str)</CODE>
|
|
|
|
<BR>
|
|
Decodes a BASE64 encoded <code>String</code>.</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="../../../com/mxgraph/util/mxBase64.html#decodeFast(byte[])">decodeFast</A></B>(byte[] sArr)</CODE>
|
|
|
|
<BR>
|
|
Decodes a BASE64 encoded byte array that is known to be resonably well formatted.</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="../../../com/mxgraph/util/mxBase64.html#decodeFast(char[])">decodeFast</A></B>(char[] sArr)</CODE>
|
|
|
|
<BR>
|
|
Decodes a BASE64 encoded char array that is known to be resonably well formatted.</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="../../../com/mxgraph/util/mxBase64.html#decodeFast(java.lang.String)">decodeFast</A></B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> s)</CODE>
|
|
|
|
<BR>
|
|
Decodes a BASE64 encoded string that is known to be resonably well formatted.</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="../../../com/mxgraph/util/mxBase64.html#encodeToByte(byte[], boolean)">encodeToByte</A></B>(byte[] sArr,
|
|
boolean lineSep)</CODE>
|
|
|
|
<BR>
|
|
Encodes a raw byte array into a BASE64 <code>byte[]</code> representation i accordance with RFC 2045.</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="../../../com/mxgraph/util/mxBase64.html#encodeToChar(byte[], boolean)">encodeToChar</A></B>(byte[] sArr,
|
|
boolean lineSep)</CODE>
|
|
|
|
<BR>
|
|
Encodes a raw byte array into a BASE64 <code>char[]</code> representation i accordance with RFC 2045.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE>static <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/mxgraph/util/mxBase64.html#encodeToString(byte[], boolean)">encodeToString</A></B>(byte[] sArr,
|
|
boolean lineSep)</CODE>
|
|
|
|
<BR>
|
|
Encodes a raw byte array into a BASE64 <code>String</code> representation i accordance with RFC 2045.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
|
|
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
|
|
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
|
|
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD><CODE><A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<P>
|
|
|
|
<!-- ========= 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="mxBase64()"><!-- --></A><H3>
|
|
mxBase64</H3>
|
|
<PRE>
|
|
public <B>mxBase64</B>()</PRE>
|
|
<DL>
|
|
</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="encodeToChar(byte[], boolean)"><!-- --></A><H3>
|
|
encodeToChar</H3>
|
|
<PRE>
|
|
public static final char[] <B>encodeToChar</B>(byte[] sArr,
|
|
boolean lineSep)</PRE>
|
|
<DL>
|
|
<DD>Encodes a raw byte array into a BASE64 <code>char[]</code> representation i accordance with RFC 2045.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>sArr</CODE> - The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.<DD><CODE>lineSep</CODE> - Optional "\r\n" after 76 characters, unless end of file.<br>
|
|
No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
|
|
little faster.
|
|
<DT><B>Returns:</B><DD>A BASE64 encoded array. Never <code>null</code>.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="decode(char[])"><!-- --></A><H3>
|
|
decode</H3>
|
|
<PRE>
|
|
public static final byte[] <B>decode</B>(char[] sArr)</PRE>
|
|
<DL>
|
|
<DD>Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with
|
|
and without line separators.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>sArr</CODE> - The source array. <code>null</code> or length 0 will return an empty array.
|
|
<DT><B>Returns:</B><DD>The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
|
|
(including '=') isn't divideable by 4. (I.e. definitely corrupted).</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="decodeFast(char[])"><!-- --></A><H3>
|
|
decodeFast</H3>
|
|
<PRE>
|
|
public static final byte[] <B>decodeFast</B>(char[] sArr)</PRE>
|
|
<DL>
|
|
<DD>Decodes a BASE64 encoded char array that is known to be resonably well formatted. The method is about twice as
|
|
fast as <A HREF="../../../com/mxgraph/util/mxBase64.html#decode(char[])"><CODE>decode(char[])</CODE></A>. The preconditions are:<br>
|
|
+ The array must have a line length of 76 chars OR no line separators at all (one line).<br>
|
|
+ Line separator must be "\r\n", as specified in RFC 2045
|
|
+ The array must not contain illegal characters within the encoded string<br>
|
|
+ The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>sArr</CODE> - The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
|
|
<DT><B>Returns:</B><DD>The decoded array of bytes. May be of length 0.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="encodeToByte(byte[], boolean)"><!-- --></A><H3>
|
|
encodeToByte</H3>
|
|
<PRE>
|
|
public static final byte[] <B>encodeToByte</B>(byte[] sArr,
|
|
boolean lineSep)</PRE>
|
|
<DL>
|
|
<DD>Encodes a raw byte array into a BASE64 <code>byte[]</code> representation i accordance with RFC 2045.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>sArr</CODE> - The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.<DD><CODE>lineSep</CODE> - Optional "\r\n" after 76 characters, unless end of file.<br>
|
|
No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
|
|
little faster.
|
|
<DT><B>Returns:</B><DD>A BASE64 encoded array. Never <code>null</code>.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="decode(byte[])"><!-- --></A><H3>
|
|
decode</H3>
|
|
<PRE>
|
|
public static final byte[] <B>decode</B>(byte[] sArr)</PRE>
|
|
<DL>
|
|
<DD>Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with
|
|
and without line separators.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>sArr</CODE> - The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
|
|
<DT><B>Returns:</B><DD>The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
|
|
(including '=') isn't divideable by 4. (I.e. definitely corrupted).</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="decodeFast(byte[])"><!-- --></A><H3>
|
|
decodeFast</H3>
|
|
<PRE>
|
|
public static final byte[] <B>decodeFast</B>(byte[] sArr)</PRE>
|
|
<DL>
|
|
<DD>Decodes a BASE64 encoded byte array that is known to be resonably well formatted. The method is about twice as
|
|
fast as <A HREF="../../../com/mxgraph/util/mxBase64.html#decode(byte[])"><CODE>decode(byte[])</CODE></A>. The preconditions are:<br>
|
|
+ The array must have a line length of 76 chars OR no line separators at all (one line).<br>
|
|
+ Line separator must be "\r\n", as specified in RFC 2045
|
|
+ The array must not contain illegal characters within the encoded string<br>
|
|
+ The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>sArr</CODE> - The source array. Length 0 will return an empty array. <code>null</code> will throw an exception.
|
|
<DT><B>Returns:</B><DD>The decoded array of bytes. May be of length 0.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="encodeToString(byte[], boolean)"><!-- --></A><H3>
|
|
encodeToString</H3>
|
|
<PRE>
|
|
public static final <A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>encodeToString</B>(byte[] sArr,
|
|
boolean lineSep)</PRE>
|
|
<DL>
|
|
<DD>Encodes a raw byte array into a BASE64 <code>String</code> representation i accordance with RFC 2045.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>sArr</CODE> - The bytes to convert. If <code>null</code> or length 0 an empty array will be returned.<DD><CODE>lineSep</CODE> - Optional "\r\n" after 76 characters, unless end of file.<br>
|
|
No line separator will be in breach of RFC 2045 which specifies max 76 per line but will be a
|
|
little faster.
|
|
<DT><B>Returns:</B><DD>A BASE64 encoded array. Never <code>null</code>.</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="decode(java.lang.String)"><!-- --></A><H3>
|
|
decode</H3>
|
|
<PRE>
|
|
public static final byte[] <B>decode</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> str)</PRE>
|
|
<DL>
|
|
<DD>Decodes a BASE64 encoded <code>String</code>. All illegal characters will be ignored and can handle both strings with
|
|
and without line separators.<br>
|
|
<b>Note!</b> It can be up to about 2x the speed to call <code>decode(str.toCharArray())</code> instead. That
|
|
will create a temporary array though. This version will use <code>str.charAt(i)</code> to iterate the string.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>str</CODE> - The source string. <code>null</code> or length 0 will return an empty array.
|
|
<DT><B>Returns:</B><DD>The decoded array of bytes. May be of length 0. Will be <code>null</code> if the legal characters
|
|
(including '=') isn't divideable by 4. (I.e. definitely corrupted).</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="decodeFast(java.lang.String)"><!-- --></A><H3>
|
|
decodeFast</H3>
|
|
<PRE>
|
|
public static final byte[] <B>decodeFast</B>(<A HREF="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> s)</PRE>
|
|
<DL>
|
|
<DD>Decodes a BASE64 encoded string that is known to be resonably well formatted. The method is about twice as
|
|
fast as <A HREF="../../../com/mxgraph/util/mxBase64.html#decode(java.lang.String)"><CODE>decode(String)</CODE></A>. The preconditions are:<br>
|
|
+ The array must have a line length of 76 chars OR no line separators at all (one line).<br>
|
|
+ Line separator must be "\r\n", as specified in RFC 2045
|
|
+ The array must not contain illegal characters within the encoded string<br>
|
|
+ The array CAN have illegal characters at the beginning and end, those will be dealt with appropriately.<br>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>s</CODE> - The source string. Length 0 will return an empty array. <code>null</code> will throw an exception.
|
|
<DT><B>Returns:</B><DD>The decoded array of bytes. May be of length 0.</DL>
|
|
</DD>
|
|
</DL>
|
|
<!-- ========= END OF CLASS DATA ========= -->
|
|
<HR>
|
|
|
|
|
|
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
|
<A NAME="navbar_bottom"><!-- --></A>
|
|
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
|
|
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
|
|
<TR>
|
|
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
|
|
<A NAME="navbar_bottom_firstrow"><!-- --></A>
|
|
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
|
|
<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/mxBase64.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>
|
|
<p><b>mxGraph 1.10.3.1</b></p></EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
PREV CLASS
|
|
<A HREF="../../../com/mxgraph/util/mxCellRenderer.html" title="class in com.mxgraph.util"><B>NEXT CLASS</B></A></FONT></TD>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../index.html?com/mxgraph/util/mxBase64.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="mxBase64.html" target="_top"><B>NO FRAMES</B></A>
|
|
<SCRIPT type="text/javascript">
|
|
<!--
|
|
if(window==top) {
|
|
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
|
|
}
|
|
//-->
|
|
</SCRIPT>
|
|
<NOSCRIPT>
|
|
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
|
|
</NOSCRIPT>
|
|
|
|
|
|
</FONT></TD>
|
|
</TR>
|
|
<TR>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
SUMMARY: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_bottom"></A>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
|
|
<HR>
|
|
<font size=1>Copyright (c) 2010 <a href="http://www.mxgraph.com/"
|
|
target="_blank">Gaudenz Alder, David Benson</a>. All rights reserved.</font>
|
|
</BODY>
|
|
</HTML>
|