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";
¡¡¡¡/** ÖÐÎij¬´ó×Ö·û¼¯ */
¡¡¡¡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 NIO APIÏê½â
ÔÚJDK
1.4ÒÔǰ£¬JavaµÄIO²Ù×÷¼¯ÖÐÔÚjava.ioÕâ¸ö°üÖУ¬ÊÇ»ùÓÚÁ÷µÄ×èÈû£¨blocking£©API¡£¶ÔÓÚ´ó¶àÊýÓ¦ÓÃÀ´Ëµ£¬ÕâÑùµÄAPIʹÓúܷ½
±ã£¬È»¶ø£¬Ò»Ð©¶ÔÐÔÄÜÒªÇó½Ï¸ßµÄÓ¦Óã¬ÓÈÆäÊÇ·þÎñ¶ËÓ¦Óã¬ÍùÍùÐèÒªÒ»¸ö¸üΪÓÐЧµÄ·½Ê½À´´¦ÀíIO¡£´ÓJDK 1.4Æð£¬NIO
API×÷Ϊһ¸ö»ùÓÚ»º³åÇø£¬²¢ÄÜÌṩ·Ç×èÈû(non-blo ......
JavaÓïÑÔ¶¨ÒåÁËpublic¡¢protected¡¢private¡¢abstract¡¢staticºÍfinalÕâ6ÖÖ³£ÓÃÐÞÊδÊÍ⻹¶¨ÒåÁË5¸ö²»Ì«³£ÓõÄÐÞÊδʣ¬ÏÂÃæÊǶÔÕâ11¸öJavaÐÞÊδʵĽéÉÜ£º
1.public
ʹÓöÔÏó£ºÀà¡¢½Ó¿Ú¡¢³ÉÔ±
½éÉÜ£ºÎÞÂÛËüËù´¦Ôڵİü¶¨ÒåÔÚÄÄ£¬¸ÃÀࣨ½Ó¿Ú¡¢³ÉÔ±£©¶¼ÊǿɷÃÎʵÄ
2.private
ʹÓöÔÏ󣺳ÉÔ±
½éÉÜ£º³ÉÔ ......
Îļþ¶ÔÏóµÄÉú³ÉºÍÎļþµÄ´´½¨
/*
* ProcessFileName.java
*
* Created on 2006Äê8ÔÂ22ÈÕ, ÏÂÎç3:10
*
* Îļþ¶ÔÏóµÄÉú³ÉºÍÎļþµÄ´´½¨
*/
package study.iostudy;
import java.io.*;
public class GenerateFile
{
public static void main(String ......
public class FilePath {
public void Print() {
String a = this.getClass().getClassLoader().getResource(".").getPath();
String b = this.getClass().getResource("").getPath();
String c = this.getClass().getResource(" ").getPath();
&n ......
ÔÎÄÀ´×Ô£ºhttp://gocom.primeton.com/modules/newbb/item44444_44444.htm
1 »ù±¾ÐÅÏ¢
ͻ񻣼
ÏÖÔÚÓкܶàµÄ¹¤¾ß½«Java´úÂë´ò°üΪexeÎļþ£¬Ö´ÐÐʱ²»ÐèÒªÔÙ±àдÅú´¦ÀíÎļþ£¬»òÕßÔÚÃüÁîÐÐÊäÈ볤³¤µÄclasspathÐÅÏ¢£¬ÎªÓû§Ê¹Óà ......