android imageBase64解密成图片

解密。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。

    /**
     * 将图片文件转化为字节数组字符串,并对其进行Base64编码处理
     * 
     * @author linbingwen
     * @since 2016年3月30日
     * @param imgFilePath 图片路径     
     * @return base64编码的字符串
     * @throws IOException 
     */
    public static String imageToBase64(String imgFilePath) throws IOException {
        byte[] data = null;
        InputStream in = null;
        try {
            in = new FileInputStream(imgFilePath);
            data = new byte[in.available()];    // 读取图片字节数组
            in.read(data);
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            if (in != null) {
                in.close();
            }
        }
        BASE64Encoder encoder = new BASE64Encoder();// 对字节数组Base64编码
        return encoder.encode(data);// 返回Base64编码过的字节数组字符串
    }

    /**
     * 对字节数组字符串进行Base64解码并生成图片
     * 
     * @author linbingwen
     * @since 2016年3月30日
     * @param imgStr base64编码的数据
     * @param imgFilePath 要保存的图片路径
     * @param imgFileName 要保存的图片名
     * @return
     * @throws IOException 
     */
    public static Boolean base64ToImage(String base64, String imgFilePath,String imgFileName) throws IOException {
        if (base64 == null) {
            return null;
        }
        BASE64Decoder decoder = new BASE64Decoder();
        OutputStream out = null;
        try {
            byte[] bytes = decoder.decodeBuffer(base64);// Base64解码
            for (int i = 0; i < bytes.length; ++i) {
                if (bytes[i] < 0) {// 调整异常数据
                    bytes[i] += 256;
                }
            }
            InputStream input = new ByteArrayInputStream(bytes);
            out = new FileOutputStream(imgFilePath + imgFileName);// 生成jpeg图片
            out.write(bytes);
            out.flush();
            return true;
        } catch (Exception e) {
            return false;
        } finally {
            if (out != null) {
                out.close();
            }
        }
    }

http://blog.sina.com.cn/s/blog_6400e5c50101qtr3.html