snipt

Ctrl+h for KB shortcuts

Java

Java decode Base64 String

byte[] decoded = Base64.getDecoder().decode(data);
InputStream stream = new ByteArrayInputStream(decoded);
https://snipt.net/embed/1597afac8da449101fcad2deb1173f68/
/raw/1597afac8da449101fcad2deb1173f68/
1597afac8da449101fcad2deb1173f68
java
Java
2
2019-08-25T09:03:36
True
False
False
Oct 28, 2015 at 03:07 PM
/api/public/snipt/142008/
java-decode-base64-string
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kt">byte</span><span class="o">[]</span> <span class="n">decoded</span> <span class="o">=</span> <span class="n">Base64</span><span class="o">.</span><span class="na">getDecoder</span><span class="o">().</span><span class="na">decode</span><span class="o">(</span><span class="n">data</span><span class="o">);</span> </span><span id="L-2"><a name="L-2"></a><span class="n">InputStream</span> <span class="n">stream</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ByteArrayInputStream</span><span class="o">(</span><span class="n">decoded</span><span class="o">);</span> </span></pre></div> </td></tr></table>
Base64, java