java字符串的各种编码转换【转贴】
import java.io.UnsupportedEncodingException;
/**
* 转换字符串的编码
*/
public class ChangeCharset
{
/** 7位ASCII字符,也叫作ISO646-US、Unicode字符集的基本拉丁块 */
public static final String US_ASCII = "US-ASCII";
/** ISO 拉丁字母表 No.1,也叫作 ISO-LATIN-1 */
public static final String ISO_8859_1 = "ISO-8859-1";
/** 8 位 UCS 转换格式 */
public static final String UTF_8 = "UTF-8";
/** 16 位 UCS 转换格式,Big Endian(最低地址存放高位字节)字节顺序 */
public static final String UTF_16BE = "UTF-16BE";
/** 16 位 UCS 转换格式,Little-endian(最高地址存放低位字节)字节顺序 */
public static final String UTF_16LE = "UTF-16LE";
/** 16 位 UCS 转换格式,字节顺序由可选的字节顺序标记来标识 */
public static final String UTF_16 = "UTF-16";
/** 中文超大字符集 */
public static final String GBK = "GBK";
/**
* 将字符编码转换成US-ASCII码
*/
public String toASCII(String str) throws UnsupportedEncodingException
{
return this.changeCharset(str, US_ASCII);
}
/**
* 将字符编码转换成ISO-8859-1码
*/
public String toISO_8859_1(String str) throws UnsupportedEncodingException
{
return this.changeCharset(str, ISO_8859_1);
}
/**
* 将字符编码转换成UTF-8码
*/
public String toUTF_8(String str) throws UnsupportedEncodingException
{
return this.changeCharset(str, UTF_8);
}
/**
* 将字符编码转换成UTF-16BE码
*/
public String toUTF_16BE(String str) throws UnsupportedEncodingException
{
return this.changeCharset(str, UTF_16BE);
}
/**
* 将字符编码转换成UTF-16LE码
*/
public String toUTF_16LE(String str) throws UnsupportedEncodingException
{
return this.changeCharset(str, UTF_16LE);
}
/**
* 将字符编码转换成UTF-16码*/
public String toUTF_16(String str) throws UnsupportedEncodingException
{
相关文档:
变量是Java 程序的一个基本存储单元。变量由一个标识符,类型及一个可选初始值的组合定义。此外,所有的变量都有一个作用域,定义变量的可见性,生存期。
声明一个变量
一、 静态初始化
在Java 中,所有的变量必须先声明再使用。基本的变量声明方 ......
/*
提供zip文件的解压缩接口:
AdapterZipFile:
输入:zipFileName(zip文件的绝对路径),outputDirectory(zip文件解压缩后的存放路径)
输出:
说明:初始化函数
unZipFile:
输入:无
输出:
说明:解压缩zip文件,解压缩 ......
import java.lang.reflect.Array;
public class ReflectionTest {
public static void main(String[] args) {
try {
Example obj = new Example();
j ......
步骤一:导入EMF的插件到相关的目录下(plugins、features)
步骤二:新建EMF Project。<!--more-->
步骤三:输入生成工程的名称
第四步:导入XSD,并且修改相应的名称:
第五步:点击finish,配置ecore相关的属性,点击保存
第六步:配置genmodel的相关属性
选中它的根目录:
我们需 ......
原文来自:http://gocom.primeton.com/modules/newbb/item44444_44444.htm
1 基本信息
摘要:
现在有很多的工具将Java代码打包为exe文件,执行时不需要再编写批处理文件,或者在命令行输入长长的classpath信息,为用户使用 ......