-
大小: 64KB文件类型: .zip金币: 2下载: 1 次发布日期: 2021-06-25
- 语言: Java
- 标签: javabase64 -1.3.1 jar Base64
资源简介
Sun公司提供的Base64转码/解码工具,包含jar包和源代码。
代码片段和文件信息
/*
* Java base64 - A pure Java library for reading and writing base64
* encoded streams.
*
* Copyright (C) 2007-2009 Carlo Pelliccia (www.sauronsoftware.it)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version
* 2.1 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License version 2.1 along with this program.
* If not see .
*/
package it.sauronsoftware.base64;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
/**
*
* base64 encoding and decoding utility methods both for binary and textual
* informations.
*
*
* @author Carlo Pelliccia
* @since 1.1
* @version 1.3
*/
public class base64 {
/**
*
* Encodes a string.
*
*
* Before the string is encoded in base64 it is converted in a binary
* sequence using the system default charset.
*
*
* @param str
* The source string.
* @return The encoded string.
* @throws RuntimeException
* If an unexpected error occurs.
*/
public static String encode(String str) throws RuntimeException {
byte[] bytes = str.getBytes();
byte[] encoded = encode(bytes);
try {
return new String(encoded “ASCII“);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(“ASCII is not supported!“ e);
}
}
/**
*
* Encodes a string.
*
*
* Before the string is encoded in base64 it is converted in a binary
* sequence using the supplied charset.
*
*
* @param str
* The source string
* @param charset
* The charset name.
* @return The encoded string.
* @throws RuntimeException
* If an unexpected error occurs.
* @since 1.2
*/
public static String encode(String str String charset)
throws RuntimeException {
byte[] bytes;
try {
bytes = str.getBytes(charset);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(“Unsupported charset: “ + charset e);
}
byte[] encoded = encode(bytes);
try {
return new String(encoded “ASCII“);
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(“ASCII is not supported!“ e);
}
}
/**
*
* Decodes the supplied string.
*
*
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
目录 0 2009-05-02 17:19 javaba
文件 492 2009-05-02 17:19 javaba
文件 352 2009-05-02 17:19 javaba
文件 26436 2009-05-02 17:19 javaba
文件 501 2009-05-02 17:19 javaba
文件 341 2009-05-02 17:19 javaba
文件 2854 2009-05-02 17:19 javaba
文件 1056 2009-05-02 17:19 javaba
文件 996 2009-05-02 17:19 javaba
文件 4983 2009-05-02 17:19 javaba
文件 4919 2009-05-02 17:19 javaba
文件 8806 2009-05-02 17:19 javaba
文件 14069 2009-05-02 17:19 javaba
文件 1348 2009-05-02 17:19 javaba
文件 27391 2009-05-02 17:19 javaba
文件 12076 2009-05-02 17:19 javaba
文件 14162 2009-05-02 17:19 javaba
............此处省略18个文件信息
- 上一篇:sqljdbc4R2.jar
- 下一篇:Java技术及SSH框架和Jsp技术的介绍
相关资源
- sqlserver2008连接所需jar包六个
- jdk和cglib动态代理的{jar包+源码}
- cglib-2.2.2.jar 和 asm-all-3.0.jar
- cglibjar包
- 传智itcast-bookstore所需jar包
- xalan-2.7.1.jar
- mysql-connector-java-5.0.8-bin驱动jar
- kettle连接数据库相关jar包
- 官方mysql-connector-java-5.1.28-bin.jar
- mysql-connector-java-5.1.17.jar
- Android直连Mysql数据库需要导入的jar包
- 音乐相关的jar
- oracle11g jar包for JDBC
- oracle 11g jdbc jar包
- mysql-5.1.40-bin jar包
- DBCP 数据源jar包
- c3p0-0.9.5.2的三个jar包 数据库连接池
- flume-ng-sql-source-1.4.1.jar
- jersey1.18 jar包
- jbpm(juel-api.jar)
- 使用JSTL需要的jar包程序文件
- jstl 和 standard jar 包
- fastjson-1.1.37.jar
- JavaMail的JAR包
- 连接数据库mysql所需jar包
- sqlserver数据库驱动jar
- slf4j-nop-1.7.7.jar
- 命令行工具在VasDolly.jar文件夹下获取
- DbVisualizer 10.0.14 破解jar包
- smali jar包
评论
共有 条评论