Java Base64 Convert to base64StrToStream(String base64Str)

Here you can find the source of base64StrToStream(String base64Str)

Description

base Str To Stream

License

Open Source License

Declaration

public static InputStream base64StrToStream(String base64Str) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import sun.misc.BASE64Decoder;

import java.io.*;

public class Main {
    public static InputStream base64StrToStream(String base64Str) throws IOException {
        if (base64Str == null) {
            throw new NullPointerException();
        }/*from  ww w .j ava2s.  co  m*/
        BASE64Decoder decoder = new BASE64Decoder();
        byte[] b = decoder.decodeBuffer(base64Str);
        return byteTostream(b);
    }

    public static InputStream byteTostream(byte[] buf) {
        return new ByteArrayInputStream(buf);
    }
}

Related

  1. base642byte(String base64)
  2. base64ToByte(String data)
  3. base64ToByteArray(String data)
  4. base64ToFile(String base64Code, String targetPath)
  5. fromBase64(byte[] buf, int start, int length)