java³ÌÐòʵÏÖutf 8ת±¾µØ»¯±àÂë
package script;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
public class Change {
public static void main(String[] args) throws Exception {
Change c = new Change();
c.utf8toLocaleCode();
}
public void utf8toLocaleCode() throws Exception {
BufferedReader br = new BufferedReader(new FileReader("D:/123.txt"));
BufferedWriter bw = new BufferedWriter(new FileWriter("D:/456.txt"));
String text = br.readLine();
while (text != null) {
String content = new String(text.getBytes("UTF-8"), "GBK");
System.out.println(content);
bw.write(content);
bw.newLine();
text = br.readLine();
}
br.close();
bw.close();
}
}
Ïà¹ØÎĵµ£º
Ò»¡¢JavaÔ´Îļþ
1¡¢Ò»¸öJavaÓ¦Óðüº¬Ò»¸ö»ò¶à¸öJavaÔ´Îļþ£¬Ã¿¸öJavaÔ´ÎļþÖ»ÄÜ°üº¬ÏÂÁÐÄÚÈÝ(¿Õ¸ñºÍ×¢ÊͳýÍâ)
l Áã¸ö»òÒ»¸ö°üÉùÃ÷Óï¾ä
l Áã¸ö»ò¶à¸ö°üÒýÈëÓï¾ä
l Áã¸ö»ò¶à¸öÀàÉùÃ÷Óï¾ä
l Áã¸ö»ò¶à¸ö½Ó¿ÚÉùÃ÷
2¡¢Ã¿¸öJavaÔ´Îļþ¿É°üº¬¶à¸öÀà»ò½Ó¿ÚµÄ¶¨Ò壬µ«ÊÇÖÁ¶àÖ»ÓÐÒ»¸öÀà»òÕß½Ó¿ÚÊÇpublicµÄ£¬¶øÇÒJavaÔ´Îļþ±ØÐëÒÔ ......
ÓÉÓÚJDKÊǹú¼Ê°æµÄ£¬ÔÚ±àÒëµÄʱºò£¬Èç¹ûÎÒÃÇûÓÐÓÃ-encoding²ÎÊýÖ¸¶¨ÎÒÃǵÄJAVAÔ´³ÌÐòµÄ±àÂë¸ñʽ£¬Ôòjavac.exeÊ×ÏÈ»ñµÃÎÒÃDzÙ×÷ϵͳĬÈϲÉÓõıàÂë¸ñʽ£¬Ò²¼´ÔÚ±àÒëjava³ÌÐòʱ£¬ÈôÎÒÃDz»Ö¸¶¨Ô´³ÌÐòÎļþµÄ±àÂë¸ñʽ£¬JDKÊ×ÏÈ»ñµÃ²Ù×÷ϵͳµÄfile.encoding²ÎÊý(Ëü±£´æµÄ¾ÍÊDzÙ×÷ϵͳĬÈϵıàÂë¸ñʽ£¬ÈçWIN2k£¬ËüµÄֵΪGBK)£¬È»º ......
¡¡¡¡ÔõôÈóÌÐòÀûÓÃËÑË÷ÒýÇæÀ´ËѼ¯ÍøÖ·£¬ÕâÓÐʲôÓÃ?ºÜÓÐÓÃ!ÍøÉ϶¯éüÓÐÈ˽ÐÂôÍøÖ·Êý¾Ý¿â£¬Èç·¢²¼Èí¼þÍøÖ·¡¢ÓʼþµØÖ·¡¢ÂÛ̳ÍøÖ·¡¢ÐÐÒµÍøÖ·£¬ÕâЩÍøÖ·ÊÇÔõôÀ´µÄÄØ?²»¿ÉÄÜÊÇÈËÊÖ¹¤ÊÕ¼¯¶øÀ´µÄ£¬¶¼ÊÇÈóÌÐòÀûÓÃËÑË÷ÒýÇæÈ¡µ½µÄ£¬Èç¹ûÄúÐèҪijÀàÍøÖ·ÐÅÏ¢Êý¾Ý£¬¾Í¸ú³É¶¼ÀÊÎÖ½ÌÓýÀ´Ò»ÆðÑо¿Ò»Ï£¬·Ç³£¼òµ¥¡£
¡¡¡¡±¾ÎIJÉÓÃJavaÓïÑÔÐ ......
¿ÉÄÜÓкܶàѧϰJavaµÄÅóÓÑ»¹²»ÖªµÀJavaµÄÔËÐÐÔÀí¡¢JavaÐéÄâ»úÊÇÔõô¹¤×÷µÄ£¬±¾ÎĽ«ÎªÄãÏêϸ½²½â(JVM)Java ÐéÄâ»ú¡£
¡¡¡¡ÔÚJavaÖÐÒýÈëÁËÐéÄâ»úµÄ¸ÅÄ¼´ÔÚ»úÆ÷ºÍ±àÒë³ÌÐòÖ®¼ä¼ÓÈëÁËÒ»²ã³éÏóµÄÐéÄâµÄ»úÆ÷¡£Õą̂ÐéÄâµÄ»úÆ÷ÔÚÈκÎƽ̨É϶¼Ìṩ¸ø±àÒë³ÌÐòÒ»¸öµÄ¹²Í¬µÄ½Ó¿Ú¡£±àÒë³ ......
¹ØÓÚJavaÉú³É±³¾°Í¸Ã÷µÄpngͼƬ
×î½üÓõ½Java¶¯Ì¬Éú³É±³¾°Í¸Ã÷µÄͼƬ¹¦ÄÜ£¬´ÓgifºÍpngÖÐÑ¡ÔñÁËpng¸ñʽ£¬¸öÖÐÔµÓɾͲ»ËµÁË£¬ÓÚÊǶ¯ÊÖµ½ÍøÉÏËÑË÷ÓÐÓõĴúÂë¡£ÏÖ°ÑËÑË÷½á¹û×ܽáÈçÏ£º
1. Éú³ÉpngͼƬ
int width = 400;
int height = 300;
// ´´½¨BufferedImage¶ÔÏó
BufferedImage&nb ......