blob: 6da377ea5c7120df9974c1733d2d25d87453df12 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en">
<head>
<!-- Generated by javadoc (17) -->
<title>Base64 (Apache Calcite Avatica API)</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="description" content="declaration: package: org.apache.calcite.avatica.util, class: Base64">
<meta name="generator" content="javadoc/ClassWriterImpl">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../script-dir/jquery-ui.min.css" title="Style">
<link rel="stylesheet" type="text/css" href="../../../../../jquery-ui.overrides.css" title="Style">
<script type="text/javascript" src="../../../../../script.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-3.5.1.min.js"></script>
<script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script>
</head>
<body class="class-declaration-page">
<script type="text/javascript">var evenRowColor = "even-row-color";
var oddRowColor = "odd-row-color";
var tableTab = "table-tab";
var activeTableTab = "active-table-tab";
var pathtoroot = "../../../../../";
loadScripts(document, 'script');</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<div class="flex-box">
<header role="banner" class="flex-header">
<nav role="navigation">
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="top-nav" id="navbar-top">
<div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div>
<div class="about-language"><b>Apache Calcite Avatica</b></div>
<ul id="navbar-top-firstrow" class="nav-list" title="Navigation">
<li><a href="../../../../../index.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="nav-bar-cell1-rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../help-doc.html#class">Help</a></li>
</ul>
</div>
<div class="sub-nav">
<div>
<ul class="sub-nav-list">
<li>Summary:&nbsp;</li>
<li><a href="#nested-class-summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field-summary">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-summary">Method</a></li>
</ul>
<ul class="sub-nav-list">
<li>Detail:&nbsp;</li>
<li><a href="#field-detail">Field</a>&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method-detail">Method</a></li>
</ul>
</div>
<div class="nav-list-search"><label for="search-input">SEARCH:</label>
<input type="text" id="search-input" value="search" disabled="disabled">
<input type="reset" id="reset-button" value="reset" disabled="disabled">
</div>
</div>
<!-- ========= END OF TOP NAVBAR ========= -->
<span class="skip-nav" id="skip-navbar-top"></span></nav>
</header>
<div class="flex-content">
<main role="main">
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="sub-title"><span class="package-label-in-type">Package</span>&nbsp;<a href="package-summary.html">org.apache.calcite.avatica.util</a></div>
<h1 title="Class Base64" class="title">Class Base64</h1>
</div>
<div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a>
<div class="inheritance">org.apache.calcite.avatica.util.Base64</div>
</div>
<section class="class-description" id="class-description">
<hr>
<div class="type-signature"><span class="modifiers">public class </span><span class="element-name type-name-label">Base64</span>
<span class="extends-implements">extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div>
<div class="block"><p>Encodes and decodes to and from Base64 notation.</p>
<p>Homepage: <a href="http://iharder.net/base64">http://iharder.net/base64</a>.</p>
<p>Example:</p>
<code>String encoded = Base64.encode( myByteArray );</code>
<br>
<code>byte[] myByteArray = Base64.decode( encoded );</code>
<p>The <code>options</code> parameter, which appears in a few places, is used to pass
several pieces of information to the encoder. In the "higher level" methods such as
encodeBytes( bytes, options ) the options parameter can be used to indicate such
things as first gzipping the bytes before encoding them, not inserting linefeeds,
and encoding using the URL-safe and Ordered dialects.</p>
<p>Note, according to <a href="http://www.faqs.org/rfcs/rfc3548.html">RFC3548</a>,
Section 2.1, implementations should not add line feeds unless explicitly told
to do so. I've got Base64 set to this behavior now, although earlier versions
broke lines by default.</p>
<p>The constants defined in Base64 can be OR-ed together to combine options, so you
might make a call like this:</p>
<code>String encoded = Base64.encodeBytes( mybytes, Base64.GZIP | Base64.DO_BREAK_LINES );</code>
<p>to compress the data before encoding it and
then making the output have newline characters.</p>
<p>Also...</p>
<code>String encoded = Base64.encodeBytes( crazyString.getBytes() );</code>
<p>
Change Log:
</p>
<ul>
<li>v2.3.7 - Fixed subtle bug when base 64 input stream contained the
value 01111111, which is an invalid base 64 character but should not
throw an ArrayIndexOutOfBoundsException either. Led to discovery of
mishandling (or potential for better handling) of other bad input
characters. You should now get an IOException if you try decoding
something that has bad characters in it.</li>
<li>v2.3.6 - Fixed bug when breaking lines and the final byte of the encoded
string ended in the last column; the buffer was not properly shrunk and
contained an extra (null) byte that made it into the string.</li>
<li>v2.3.5 - Fixed bug in <a href="#encodeFromFile(java.lang.String)"><code>encodeFromFile(java.lang.String)</code></a> where estimated buffer size
was wrong for files of size 31, 34, and 37 bytes.</li>
<li>v2.3.4 - Fixed bug when working with gzipped streams whereby flushing
the Base64.OutputStream closed the Base64 encoding (by padding with equals
signs) too soon. Also added an option to suppress the automatic decoding
of gzipped streams. Also added experimental support for specifying a
class loader when using the
<a href="#decodeToObject(java.lang.String,int,java.lang.ClassLoader)"><code>decodeToObject(java.lang.String, int, java.lang.ClassLoader)</code></a>
method.</li>
<li>v2.3.3 - Changed default char encoding to US-ASCII which reduces the internal Java
footprint with its CharEncoders and so forth. Fixed some javadocs that were
inconsistent. Removed imports and specified things like java.io.IOException
explicitly inline.</li>
<li>v2.3.2 - Reduced memory footprint! Finally refined the "guessing" of how big the
final encoded data will be so that the code doesn't have to create two output
arrays: an oversized initial one and then a final, exact-sized one. Big win
when using the <a href="#encodeBytesToBytes(byte%5B%5D)"><code>encodeBytesToBytes(byte[])</code></a> family of methods (and not
using the gzip options which uses a different mechanism with streams and stuff).</li>
<li>v2.3.1 - Added <a href="#encodeBytesToBytes(byte%5B%5D,int,int,int)"><code>encodeBytesToBytes(byte[], int, int, int)</code></a> and some
similar helper methods to be more efficient with memory by not returning a
String but just a byte array.</li>
<li>v2.3 - <strong>This is not a drop-in replacement!</strong> This is two years of comments
and bug fixes queued up and finally executed. Thanks to everyone who sent
me stuff, and I'm sorry I wasn't able to distribute your fixes to everyone else.
Much bad coding was cleaned up including throwing exceptions where necessary
instead of returning null values or something similar. Here are some changes
that may affect you:
<ul>
<li><em>Does not break lines, by default.</em> This is to keep in compliance with
<a href="http://www.faqs.org/rfcs/rfc3548.html">RFC3548</a>.</li>
<li><em>Throws exceptions instead of returning null values.</em> Because some operations
(especially those that may permit the GZIP option) use IO streams, there
is a possiblity of an java.io.IOException being thrown. After some discussion and
thought, I've changed the behavior of the methods to throw java.io.IOExceptions
rather than return null if ever there's an error. I think this is more
appropriate, though it will require some changes to your code. Sorry,
it should have been done this way to begin with.</li>
<li><em>Removed all references to System.out, System.err, and the like.</em>
Shame on me. All I can say is sorry they were ever there.</li>
<li><em>Throws NullPointerExceptions and IllegalArgumentExceptions</em> as needed
such as when passed arrays are null or offsets are invalid.</li>
<li>Cleaned up as much javadoc as I could to avoid any javadoc warnings.
This was especially annoying before for people who were thorough in their
own projects and then had gobs of javadoc warnings on this file.</li>
</ul>
<li>v2.2.1 - Fixed bug using URL_SAFE and ORDERED encodings. Fixed bug
when using very small files (~&lt; 40 bytes).</li>
<li>v2.2 - Added some helper methods for encoding/decoding directly from
one file to the next. Also added a main() method to support command line
encoding/decoding from one file to the next. Also added these Base64 dialects:
<ol>
<li>The default is RFC3548 format.</li>
<li>Calling Base64.setFormat(Base64.BASE64_FORMAT.URLSAFE_FORMAT) generates
URL and file name friendly format as described in Section 4 of RFC3548.
http://www.faqs.org/rfcs/rfc3548.html</li>
<li>Calling Base64.setFormat(Base64.BASE64_FORMAT.ORDERED_FORMAT) generates
URL and file name friendly format that preserves lexical ordering as described
in http://www.faqs.org/qa/rfcc-1940.html</li>
</ol>
Special thanks to Jim Kellerman at <a href="http://www.powerset.com/">http://www.powerset.com/</a>
for contributing the new Base64 dialects.
</li>
<li>v2.1 - Cleaned up javadoc comments and unused variables and methods. Added
some convenience methods for reading and writing to and from files.</li>
<li>v2.0.2 - Now specifies UTF-8 encoding in places where the code fails on systems
with other encodings (like EBCDIC).</li>
<li>v2.0.1 - Fixed an error when decoding a single byte, that is, when the
encoded data was a single byte.</li>
<li>v2.0 - I got rid of methods that used booleans to set options.
Now everything is more consolidated and cleaner. The code now detects
when data that's being decoded is gzip-compressed and will decompress it
automatically. Generally things are cleaner. You'll probably have to
change some method calls that you were making to support the new
options format (<code>int</code>s that you "OR" together).</li>
<li>v1.5.1 - Fixed bug when decompressing and decoding to a
byte[] using <code>decode( String s, boolean gzipCompressed )</code>.
Added the ability to "suspend" encoding in the Output Stream so
you can turn on and off the encoding if you need to embed base64
data in an otherwise "normal" stream (like an XML file).</li>
<li>v1.5 - Output stream pases on flush() command but doesn't do anything itself.
This helps when using GZIP streams.
Added the ability to GZip-compress objects before encoding them.</li>
<li>v1.4 - Added helper methods to read/write files.</li>
<li>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset.</li>
<li>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in input stream
where last buffer being read, if not completely full, was not returned.</li>
<li>v1.3.4 - Fixed when "improperly padded stream" error was thrown at the wrong time.</li>
<li>v1.3.3 - Fixed I/O streams which were totally messed up.</li>
</ul>
<p>
I am placing this code in the Public Domain. Do with it as you will.
This software comes with no guarantees or warranties but with
plenty of well-wishing instead!
Please visit <a href="http://iharder.net/base64">http://iharder.net/base64</a>
periodically to check for updates or to contribute improvements.
</p></div>
</section>
<section class="summary">
<ul class="summary-list">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<li>
<section class="nested-class-summary" id="nested-class-summary">
<h2>Nested Class Summary</h2>
<div class="caption"><span>Nested Classes</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Class</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static class&nbsp;</code></div>
<div class="col-second even-row-color"><code><a href="Base64.InputStream.html" class="type-name-link" title="class in org.apache.calcite.avatica.util">Base64.InputStream</a></code></div>
<div class="col-last even-row-color">
<div class="block">A <a href="Base64.InputStream.html" title="class in org.apache.calcite.avatica.util"><code>Base64.InputStream</code></a> will read data from another
<code>java.io.InputStream</code>, given in the constructor,
and encode/decode to/from Base64 notation on the fly.</div>
</div>
<div class="col-first odd-row-color"><code>static class&nbsp;</code></div>
<div class="col-second odd-row-color"><code><a href="Base64.OutputStream.html" class="type-name-link" title="class in org.apache.calcite.avatica.util">Base64.OutputStream</a></code></div>
<div class="col-last odd-row-color">
<div class="block">A <a href="Base64.OutputStream.html" title="class in org.apache.calcite.avatica.util"><code>Base64.OutputStream</code></a> will write data to another
<code>java.io.OutputStream</code>, given in the constructor,
and encode/decode to/from Base64 notation on the fly.</div>
</div>
</div>
</section>
</li>
<!-- =========== FIELD SUMMARY =========== -->
<li>
<section class="field-summary" id="field-summary">
<h2>Field Summary</h2>
<div class="caption"><span>Fields</span></div>
<div class="summary-table three-column-summary">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Field</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color"><code>static final int</code></div>
<div class="col-second even-row-color"><code><a href="#DECODE" class="member-name-link">DECODE</a></code></div>
<div class="col-last even-row-color">
<div class="block">Specify decoding in first bit.</div>
</div>
<div class="col-first odd-row-color"><code>static final int</code></div>
<div class="col-second odd-row-color"><code><a href="#DO_BREAK_LINES" class="member-name-link">DO_BREAK_LINES</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Do break lines when encoding.</div>
</div>
<div class="col-first even-row-color"><code>static final int</code></div>
<div class="col-second even-row-color"><code><a href="#DONT_GUNZIP" class="member-name-link">DONT_GUNZIP</a></code></div>
<div class="col-last even-row-color">
<div class="block">Specify that gzipped data should <em>not</em> be automatically gunzipped.</div>
</div>
<div class="col-first odd-row-color"><code>static final int</code></div>
<div class="col-second odd-row-color"><code><a href="#ENCODE" class="member-name-link">ENCODE</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Specify encoding in first bit.</div>
</div>
<div class="col-first even-row-color"><code>static final int</code></div>
<div class="col-second even-row-color"><code><a href="#GZIP" class="member-name-link">GZIP</a></code></div>
<div class="col-last even-row-color">
<div class="block">Specify that data should be gzip-compressed in second bit.</div>
</div>
<div class="col-first odd-row-color"><code>static final int</code></div>
<div class="col-second odd-row-color"><code><a href="#NO_OPTIONS" class="member-name-link">NO_OPTIONS</a></code></div>
<div class="col-last odd-row-color">
<div class="block">No options specified.</div>
</div>
<div class="col-first even-row-color"><code>static final int</code></div>
<div class="col-second even-row-color"><code><a href="#ORDERED" class="member-name-link">ORDERED</a></code></div>
<div class="col-last even-row-color">
<div class="block">Encode using the special "ordered" dialect of Base64 described here:
<a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.</div>
</div>
<div class="col-first odd-row-color"><code>static final int</code></div>
<div class="col-second odd-row-color"><code><a href="#URL_SAFE" class="member-name-link">URL_SAFE</a></code></div>
<div class="col-last odd-row-color">
<div class="block">Encode using Base64-like encoding that is URL- and Filename-safe as described
in Section 4 of RFC3548:
<a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.</div>
</div>
</div>
</section>
</li>
<!-- ========== METHOD SUMMARY =========== -->
<li>
<section class="method-summary" id="method-summary">
<h2>Method Summary</h2>
<div id="method-summary-table">
<div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div>
<div id="method-summary-table.tabpanel" role="tabpanel">
<div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0">
<div class="table-header col-first">Modifier and Type</div>
<div class="table-header col-second">Method</div>
<div class="table-header col-last">Description</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decode(byte%5B%5D)" class="member-name-link">decode</a><wbr>(byte[]&nbsp;source)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Low-level access to decoding ASCII characters in
the form of a byte array.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte[]</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decode(byte%5B%5D,int,int,int)" class="member-name-link">decode</a><wbr>(byte[]&nbsp;source,
int&nbsp;off,
int&nbsp;len,
int&nbsp;options)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Low-level access to decoding ASCII characters in
the form of a byte array.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decode(java.lang.String)" class="member-name-link">decode</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;s)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Decodes data from Base64 notation, automatically
detecting gzip-compressed data and decompressing it.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte[]</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decode(java.lang.String,int)" class="member-name-link">decode</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;s,
int&nbsp;options)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Decodes data from Base64 notation, automatically
detecting gzip-compressed data and decompressing it.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decodeFileToFile(java.lang.String,java.lang.String)" class="member-name-link">decodeFileToFile</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;infile,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;outfile)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Reads <code>infile</code> and decodes it to <code>outfile</code>.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte[]</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decodeFromFile(java.lang.String)" class="member-name-link">decodeFromFile</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filename)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Convenience method for reading a base64-encoded
file and decoding it.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decodeToFile(java.lang.String,java.lang.String)" class="member-name-link">decodeToFile</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;dataToDecode,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filename)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Convenience method for decoding data to a file.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decodeToObject(java.lang.String)" class="member-name-link">decodeToObject</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;encodedObject)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Attempts to decode Base64 data and deserialize a Java
Object within.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#decodeToObject(java.lang.String,int,java.lang.ClassLoader)" class="member-name-link">decodeToObject</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;encodedObject,
int&nbsp;options,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html" title="class or interface in java.lang" class="external-link">ClassLoader</a>&nbsp;loader)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Attempts to decode Base64 data and deserialize a Java
Object within.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encode(java.nio.ByteBuffer,java.nio.ByteBuffer)" class="member-name-link">encode</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link">ByteBuffer</a>&nbsp;raw,
<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link">ByteBuffer</a>&nbsp;encoded)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Performs Base64 encoding on the <code>raw</code> ByteBuffer,
writing it to the <code>encoded</code> ByteBuffer.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encode(java.nio.ByteBuffer,java.nio.CharBuffer)" class="member-name-link">encode</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link">ByteBuffer</a>&nbsp;raw,
<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/CharBuffer.html" title="class or interface in java.nio" class="external-link">CharBuffer</a>&nbsp;encoded)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Performs Base64 encoding on the <code>raw</code> ByteBuffer,
writing it to the <code>encoded</code> CharBuffer.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeBytes(byte%5B%5D)" class="member-name-link">encodeBytes</a><wbr>(byte[]&nbsp;source)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Encodes a byte array into Base64 notation.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeBytes(byte%5B%5D,int)" class="member-name-link">encodeBytes</a><wbr>(byte[]&nbsp;source,
int&nbsp;options)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Encodes a byte array into Base64 notation.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeBytes(byte%5B%5D,int,int)" class="member-name-link">encodeBytes</a><wbr>(byte[]&nbsp;source,
int&nbsp;off,
int&nbsp;len)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Encodes a byte array into Base64 notation.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeBytes(byte%5B%5D,int,int,int)" class="member-name-link">encodeBytes</a><wbr>(byte[]&nbsp;source,
int&nbsp;off,
int&nbsp;len,
int&nbsp;options)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Encodes a byte array into Base64 notation.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte[]</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeBytesToBytes(byte%5B%5D)" class="member-name-link">encodeBytesToBytes</a><wbr>(byte[]&nbsp;source)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Similar to <a href="#encodeBytes(byte%5B%5D)"><code>encodeBytes(byte[])</code></a> but returns
a byte array instead of instantiating a String.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static byte[]</code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeBytesToBytes(byte%5B%5D,int,int,int)" class="member-name-link">encodeBytesToBytes</a><wbr>(byte[]&nbsp;source,
int&nbsp;off,
int&nbsp;len,
int&nbsp;options)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Similar to <a href="#encodeBytes(byte%5B%5D,int,int,int)"><code>encodeBytes(byte[], int, int, int)</code></a> but returns
a byte array instead of instantiating a String.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeFileToFile(java.lang.String,java.lang.String)" class="member-name-link">encodeFileToFile</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;infile,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;outfile)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Reads <code>infile</code> and encodes it to <code>outfile</code>.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeFromFile(java.lang.String)" class="member-name-link">encodeFromFile</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filename)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Convenience method for reading a binary file
and base64-encoding it.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeObject(java.io.Serializable)" class="member-name-link">encodeObject</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a>&nbsp;serializableObject)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Serializes an object and returns the Base64-encoded
version of that serialized object.</div>
</div>
<div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div>
<div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeObject(java.io.Serializable,int)" class="member-name-link">encodeObject</a><wbr>(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a>&nbsp;serializableObject,
int&nbsp;options)</code></div>
<div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Serializes an object and returns the Base64-encoded
version of that serialized object.</div>
</div>
<div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static void</code></div>
<div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#encodeToFile(byte%5B%5D,java.lang.String)" class="member-name-link">encodeToFile</a><wbr>(byte[]&nbsp;dataToEncode,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filename)</code></div>
<div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4">
<div class="block">Convenience method for encoding data to a file.</div>
</div>
</div>
</div>
</div>
<div class="inherited-list">
<h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class&nbsp;java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3>
<code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div>
</section>
</li>
</ul>
</section>
<section class="details">
<ul class="details-list">
<!-- ============ FIELD DETAIL =========== -->
<li>
<section class="field-details" id="field-detail">
<h2>Field Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="NO_OPTIONS">
<h3>NO_OPTIONS</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">NO_OPTIONS</span></div>
<div class="block">No options specified. Value is zero.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../constant-values.html#org.apache.calcite.avatica.util.Base64.NO_OPTIONS">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="ENCODE">
<h3>ENCODE</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">ENCODE</span></div>
<div class="block">Specify encoding in first bit. Value is one.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../constant-values.html#org.apache.calcite.avatica.util.Base64.ENCODE">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="DECODE">
<h3>DECODE</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">DECODE</span></div>
<div class="block">Specify decoding in first bit. Value is zero.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../constant-values.html#org.apache.calcite.avatica.util.Base64.DECODE">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="GZIP">
<h3>GZIP</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">GZIP</span></div>
<div class="block">Specify that data should be gzip-compressed in second bit. Value is two.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../constant-values.html#org.apache.calcite.avatica.util.Base64.GZIP">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="DONT_GUNZIP">
<h3>DONT_GUNZIP</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">DONT_GUNZIP</span></div>
<div class="block">Specify that gzipped data should <em>not</em> be automatically gunzipped.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../constant-values.html#org.apache.calcite.avatica.util.Base64.DONT_GUNZIP">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="DO_BREAK_LINES">
<h3>DO_BREAK_LINES</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">DO_BREAK_LINES</span></div>
<div class="block">Do break lines when encoding. Value is 8.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../constant-values.html#org.apache.calcite.avatica.util.Base64.DO_BREAK_LINES">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="URL_SAFE">
<h3>URL_SAFE</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">URL_SAFE</span></div>
<div class="block">Encode using Base64-like encoding that is URL- and Filename-safe as described
in Section 4 of RFC3548:
<a href="http://www.faqs.org/rfcs/rfc3548.html">http://www.faqs.org/rfcs/rfc3548.html</a>.
It is important to note that data encoded this way is <em>not</em> officially valid Base64,
or at the very least should not be called Base64 without also specifying that is
was encoded using the URL- and Filename-safe dialect.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../constant-values.html#org.apache.calcite.avatica.util.Base64.URL_SAFE">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="ORDERED">
<h3>ORDERED</h3>
<div class="member-signature"><span class="modifiers">public static final</span>&nbsp;<span class="return-type">int</span>&nbsp;<span class="element-name">ORDERED</span></div>
<div class="block">Encode using the special "ordered" dialect of Base64 described here:
<a href="http://www.faqs.org/qa/rfcc-1940.html">http://www.faqs.org/qa/rfcc-1940.html</a>.</div>
<dl class="notes">
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="../../../../../constant-values.html#org.apache.calcite.avatica.util.Base64.ORDERED">Constant Field Values</a></li>
</ul>
</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
<!-- ============ METHOD DETAIL ========== -->
<li>
<section class="method-details" id="method-detail">
<h2>Method Details</h2>
<ul class="member-list">
<li>
<section class="detail" id="encode(java.nio.ByteBuffer,java.nio.ByteBuffer)">
<h3>encode</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">encode</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link">ByteBuffer</a>&nbsp;raw,
<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link">ByteBuffer</a>&nbsp;encoded)</span></div>
<div class="block">Performs Base64 encoding on the <code>raw</code> ByteBuffer,
writing it to the <code>encoded</code> ByteBuffer.
This is an experimental feature. Currently it does not
pass along any options (such as <a href="#DO_BREAK_LINES"><code>DO_BREAK_LINES</code></a>
or <a href="#GZIP"><code>GZIP</code></a>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>raw</code> - input buffer</dd>
<dd><code>encoded</code> - output buffer</dd>
<dt>Since:</dt>
<dd>2.3</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encode(java.nio.ByteBuffer,java.nio.CharBuffer)">
<h3>encode</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">encode</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html" title="class or interface in java.nio" class="external-link">ByteBuffer</a>&nbsp;raw,
<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/CharBuffer.html" title="class or interface in java.nio" class="external-link">CharBuffer</a>&nbsp;encoded)</span></div>
<div class="block">Performs Base64 encoding on the <code>raw</code> ByteBuffer,
writing it to the <code>encoded</code> CharBuffer.
This is an experimental feature. Currently it does not
pass along any options (such as <a href="#DO_BREAK_LINES"><code>DO_BREAK_LINES</code></a>
or <a href="#GZIP"><code>GZIP</code></a>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>raw</code> - input buffer</dd>
<dd><code>encoded</code> - output buffer</dd>
<dt>Since:</dt>
<dd>2.3</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeObject(java.io.Serializable)">
<h3>encodeObject</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">encodeObject</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a>&nbsp;serializableObject)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Serializes an object and returns the Base64-encoded
version of that serialized object.
<p>As of v 2.3, if the object
cannot be serialized or there is another error,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned a null value, but
in retrospect that's a pretty poor way to handle it.</p>
The object is not GZip-compressed before being encoded.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>serializableObject</code> - The object to encode</dd>
<dt>Returns:</dt>
<dd>The Base64-encoded object</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if serializedObject is null</dd>
<dt>Since:</dt>
<dd>1.4</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeObject(java.io.Serializable,int)">
<h3>encodeObject</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">encodeObject</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html" title="class or interface in java.io" class="external-link">Serializable</a>&nbsp;serializableObject,
int&nbsp;options)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Serializes an object and returns the Base64-encoded
version of that serialized object.
<p>As of v 2.3, if the object
cannot be serialized or there is another error,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned a null value, but
in retrospect that's a pretty poor way to handle it.</p>
The object is not GZip-compressed before being encoded.
<p>
Example options:<pre>
GZIP: gzip-compresses object before encoding it.
DO_BREAK_LINES: break lines at 76 characters
</pre>
<p>
Example: <code>encodeObject( myObj, Base64.GZIP )</code> or
<p>
Example: <code>encodeObject( myObj, Base64.GZIP | Base64.DO_BREAK_LINES )</code></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>serializableObject</code> - The object to encode</dd>
<dd><code>options</code> - Specified options</dd>
<dt>Returns:</dt>
<dd>The Base64-encoded object</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dt>Since:</dt>
<dd>2.0</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="#GZIP"><code>GZIP</code></a></li>
<li><a href="#DO_BREAK_LINES"><code>DO_BREAK_LINES</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeBytes(byte[])">
<h3>encodeBytes</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">encodeBytes</span><wbr><span class="parameters">(byte[]&nbsp;source)</span></div>
<div class="block">Encodes a byte array into Base64 notation.
Does not GZip-compress data.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>source</code> - The data to convert</dd>
<dt>Returns:</dt>
<dd>The data in Base64-encoded form</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if source array is null</dd>
<dt>Since:</dt>
<dd>1.4</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeBytes(byte[],int)">
<h3>encodeBytes</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">encodeBytes</span><wbr><span class="parameters">(byte[]&nbsp;source,
int&nbsp;options)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Encodes a byte array into Base64 notation.
<p>
Example options:<pre>
GZIP: gzip-compresses object before encoding it.
DO_BREAK_LINES: 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.DO_BREAK_LINES )</code>
<p>As of v 2.3, if there is an error with the GZIP stream,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned a null value, but
in retrospect that's a pretty poor way to handle it.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>source</code> - The data to convert</dd>
<dd><code>options</code> - Specified options</dd>
<dt>Returns:</dt>
<dd>The Base64-encoded data as a String</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if source array is null</dd>
<dt>Since:</dt>
<dd>2.0</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="#GZIP"><code>GZIP</code></a></li>
<li><a href="#DO_BREAK_LINES"><code>DO_BREAK_LINES</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeBytes(byte[],int,int)">
<h3>encodeBytes</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">encodeBytes</span><wbr><span class="parameters">(byte[]&nbsp;source,
int&nbsp;off,
int&nbsp;len)</span></div>
<div class="block">Encodes a byte array into Base64 notation.
Does not GZip-compress data.
<p>As of v 2.3, if there is an error,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned a null value, but
in retrospect that's a pretty poor way to handle it.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>source</code> - The data to convert</dd>
<dd><code>off</code> - Offset in array where conversion should begin</dd>
<dd><code>len</code> - Length of data to convert</dd>
<dt>Returns:</dt>
<dd>The Base64-encoded data as a String</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if source array is null</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if source array, offset, or length are invalid</dd>
<dt>Since:</dt>
<dd>1.4</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeBytes(byte[],int,int,int)">
<h3>encodeBytes</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">encodeBytes</span><wbr><span class="parameters">(byte[]&nbsp;source,
int&nbsp;off,
int&nbsp;len,
int&nbsp;options)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Encodes a byte array into Base64 notation.
<p>
Example options:<pre>
GZIP: gzip-compresses object before encoding it.
DO_BREAK_LINES: 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.DO_BREAK_LINES )</code>
<p>As of v 2.3, if there is an error with the GZIP stream,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned a null value, but
in retrospect that's a pretty poor way to handle it.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>source</code> - The data to convert</dd>
<dd><code>off</code> - Offset in array where conversion should begin</dd>
<dd><code>len</code> - Length of data to convert</dd>
<dd><code>options</code> - Specified options</dd>
<dt>Returns:</dt>
<dd>The Base64-encoded data as a String</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if source array is null</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if source array, offset, or length are invalid</dd>
<dt>Since:</dt>
<dd>2.0</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="#GZIP"><code>GZIP</code></a></li>
<li><a href="#DO_BREAK_LINES"><code>DO_BREAK_LINES</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeBytesToBytes(byte[])">
<h3>encodeBytesToBytes</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name">encodeBytesToBytes</span><wbr><span class="parameters">(byte[]&nbsp;source)</span></div>
<div class="block">Similar to <a href="#encodeBytes(byte%5B%5D)"><code>encodeBytes(byte[])</code></a> but returns
a byte array instead of instantiating a String. This is more efficient
if you're working with I/O streams and have large data sets to encode.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>source</code> - The data to convert</dd>
<dt>Returns:</dt>
<dd>The Base64-encoded data as a byte[] (of ASCII characters)</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if source array is null</dd>
<dt>Since:</dt>
<dd>2.3.1</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeBytesToBytes(byte[],int,int,int)">
<h3>encodeBytesToBytes</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name">encodeBytesToBytes</span><wbr><span class="parameters">(byte[]&nbsp;source,
int&nbsp;off,
int&nbsp;len,
int&nbsp;options)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Similar to <a href="#encodeBytes(byte%5B%5D,int,int,int)"><code>encodeBytes(byte[], int, int, int)</code></a> but returns
a byte array instead of instantiating a String. This is more efficient
if you're working with I/O streams and have large data sets to encode.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>source</code> - The data to convert</dd>
<dd><code>off</code> - Offset in array where conversion should begin</dd>
<dd><code>len</code> - Length of data to convert</dd>
<dd><code>options</code> - Specified options</dd>
<dt>Returns:</dt>
<dd>The Base64-encoded data as a String</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if source array is null</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/IllegalArgumentException.html" title="class or interface in java.lang" class="external-link">IllegalArgumentException</a></code> - if source array, offset, or length are invalid</dd>
<dt>Since:</dt>
<dd>2.3.1</dd>
<dt>See Also:</dt>
<dd>
<ul class="see-list">
<li><a href="#GZIP"><code>GZIP</code></a></li>
<li><a href="#DO_BREAK_LINES"><code>DO_BREAK_LINES</code></a></li>
</ul>
</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decode(byte[])">
<h3>decode</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name">decode</span><wbr><span class="parameters">(byte[]&nbsp;source)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Low-level access to decoding ASCII characters in
the form of a byte array. <strong>Ignores GUNZIP option, if
it's set.</strong> This is not generally a recommended method,
although it is used internally as part of the decoding process.
Special case: if len = 0, an empty array is returned. Still,
if you need more speed and reduced memory footprint (and aren't
gzipping), consider this method.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>source</code> - The Base64 encoded data</dd>
<dt>Returns:</dt>
<dd>decoded data</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd>
<dt>Since:</dt>
<dd>2.3.1</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decode(byte[],int,int,int)">
<h3>decode</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name">decode</span><wbr><span class="parameters">(byte[]&nbsp;source,
int&nbsp;off,
int&nbsp;len,
int&nbsp;options)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Low-level access to decoding ASCII characters in
the form of a byte array. <strong>Ignores GUNZIP option, if
it's set.</strong> This is not generally a recommended method,
although it is used internally as part of the decoding process.
Special case: if len = 0, an empty array is returned. Still,
if you need more speed and reduced memory footprint (and aren't
gzipping), consider this method.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>source</code> - The Base64 encoded data</dd>
<dd><code>off</code> - The offset of where to begin decoding</dd>
<dd><code>len</code> - The length of characters to decode</dd>
<dd><code>options</code> - Can specify options such as alphabet type to use</dd>
<dt>Returns:</dt>
<dd>decoded data</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - If bogus characters exist in source data</dd>
<dt>Since:</dt>
<dd>1.3</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decode(java.lang.String)">
<h3>decode</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name">decode</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;s)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Decodes data from Base64 notation, automatically
detecting gzip-compressed data and decompressing it.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>s</code> - the string to decode</dd>
<dt>Returns:</dt>
<dd>the decoded data</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - If there is a problem</dd>
<dt>Since:</dt>
<dd>1.4</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decode(java.lang.String,int)">
<h3>decode</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name">decode</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;s,
int&nbsp;options)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Decodes data from Base64 notation, automatically
detecting gzip-compressed data and decompressing it.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>s</code> - the string to decode</dd>
<dd><code>options</code> - encode options such as URL_SAFE</dd>
<dt>Returns:</dt>
<dd>the decoded data</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if <code>s</code> is null</dd>
<dt>Since:</dt>
<dd>1.4</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decodeToObject(java.lang.String)">
<h3>decodeToObject</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span>&nbsp;<span class="element-name">decodeToObject</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;encodedObject)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassNotFoundException.html" title="class or interface in java.lang" class="external-link">ClassNotFoundException</a></span></div>
<div class="block">Attempts to decode Base64 data and deserialize a Java
Object within. Returns <code>null</code> if there was an error.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>encodedObject</code> - The Base64 data to decode</dd>
<dt>Returns:</dt>
<dd>The decoded and deserialized object</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if encodedObject is null</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is a general error</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassNotFoundException.html" title="class or interface in java.lang" class="external-link">ClassNotFoundException</a></code> - if the decoded object is of a
class that cannot be found by the JVM</dd>
<dt>Since:</dt>
<dd>1.5</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decodeToObject(java.lang.String,int,java.lang.ClassLoader)">
<h3>decodeToObject</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span>&nbsp;<span class="element-name">decodeToObject</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;encodedObject,
int&nbsp;options,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassLoader.html" title="class or interface in java.lang" class="external-link">ClassLoader</a>&nbsp;loader)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a>,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassNotFoundException.html" title="class or interface in java.lang" class="external-link">ClassNotFoundException</a></span></div>
<div class="block">Attempts to decode Base64 data and deserialize a Java
Object within. Returns <code>null</code> if there was an error.
If <code>loader</code> is not null, it will be the class loader
used when deserializing.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>encodedObject</code> - The Base64 data to decode</dd>
<dd><code>options</code> - Various parameters related to decoding</dd>
<dd><code>loader</code> - Optional class loader to use in deserializing classes.</dd>
<dt>Returns:</dt>
<dd>The decoded and deserialized object</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if encodedObject is null</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is a general error</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/ClassNotFoundException.html" title="class or interface in java.lang" class="external-link">ClassNotFoundException</a></code> - if the decoded object is of a
class that cannot be found by the JVM</dd>
<dt>Since:</dt>
<dd>2.3.4</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeToFile(byte[],java.lang.String)">
<h3>encodeToFile</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">encodeToFile</span><wbr><span class="parameters">(byte[]&nbsp;dataToEncode,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filename)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Convenience method for encoding data to a file.
<p>As of v 2.3, if there is a error,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned false, but
in retrospect that's a pretty poor way to handle it.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>dataToEncode</code> - byte array of data to encode in base64 form</dd>
<dd><code>filename</code> - Filename for saving encoded data</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/NullPointerException.html" title="class or interface in java.lang" class="external-link">NullPointerException</a></code> - if dataToEncode is null</dd>
<dt>Since:</dt>
<dd>2.1</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decodeToFile(java.lang.String,java.lang.String)">
<h3>decodeToFile</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">decodeToFile</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;dataToDecode,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filename)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Convenience method for decoding data to a file.
<p>As of v 2.3, if there is a error,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned false, but
in retrospect that's a pretty poor way to handle it.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>dataToDecode</code> - Base64-encoded data as a string</dd>
<dd><code>filename</code> - Filename for saving decoded data</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dt>Since:</dt>
<dd>2.1</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decodeFromFile(java.lang.String)">
<h3>decodeFromFile</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">byte[]</span>&nbsp;<span class="element-name">decodeFromFile</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filename)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Convenience method for reading a base64-encoded
file and decoding it.
<p>As of v 2.3, if there is a error,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned false, but
in retrospect that's a pretty poor way to handle it.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>filename</code> - Filename for reading encoded data</dd>
<dt>Returns:</dt>
<dd>decoded byte array</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dt>Since:</dt>
<dd>2.1</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeFromFile(java.lang.String)">
<h3>encodeFromFile</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type"><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span>&nbsp;<span class="element-name">encodeFromFile</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;filename)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Convenience method for reading a binary file
and base64-encoding it.
<p>As of v 2.3, if there is a error,
the method will throw an java.io.IOException. <b>This is new to v2.3!</b>
In earlier versions, it just returned false, but
in retrospect that's a pretty poor way to handle it.</p></div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>filename</code> - Filename for reading binary data</dd>
<dt>Returns:</dt>
<dd>base64-encoded string</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dt>Since:</dt>
<dd>2.1</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="encodeFileToFile(java.lang.String,java.lang.String)">
<h3>encodeFileToFile</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">encodeFileToFile</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;infile,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;outfile)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Reads <code>infile</code> and encodes it to <code>outfile</code>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>infile</code> - Input file</dd>
<dd><code>outfile</code> - Output file</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dt>Since:</dt>
<dd>2.2</dd>
</dl>
</section>
</li>
<li>
<section class="detail" id="decodeFileToFile(java.lang.String,java.lang.String)">
<h3>decodeFileToFile</h3>
<div class="member-signature"><span class="modifiers">public static</span>&nbsp;<span class="return-type">void</span>&nbsp;<span class="element-name">decodeFileToFile</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;infile,
<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a>&nbsp;outfile)</span>
throws <span class="exceptions"><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div>
<div class="block">Reads <code>infile</code> and decodes it to <code>outfile</code>.</div>
<dl class="notes">
<dt>Parameters:</dt>
<dd><code>infile</code> - Input file</dd>
<dd><code>outfile</code> - Output file</dd>
<dt>Throws:</dt>
<dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code> - if there is an error</dd>
<dt>Since:</dt>
<dd>2.2</dd>
</dl>
</section>
</li>
</ul>
</section>
</li>
</ul>
</section>
<!-- ========= END OF CLASS DATA ========= -->
</main>
<footer role="contentinfo">
<hr>
<p class="legal-copy"><small>Copyright &copy; 2012-2023 Apache Software Foundation. All Rights Reserved.</small></p>
</footer>
</div>
</div>
</body>
</html>