Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java byteÓëchar»¥×ªÔ­Àí ת

java byteÓëchar»¥×ªÔ­Àí-ת
Ò»¡¢×Ö½ÚºÍunicode
JavaÄÚºËÊÇunicodeµÄ£¬¾ÍÁ¬classÎļþÒ²ÊÇ£¬µ«ÊǺܶàýÌ壬°üÀ¨Îļþ/Á÷µÄ±£´æ·½Ê½ÊÇʹÓÃ×Ö½ÚÁ÷µÄ¡£Òò´ËJavaÒª¶ÔÕâЩ×Ö½ÚÁ÷¾­ÐÐת»¯¡£ charÊÇunicodeµÄ£¬¶øbyteÊÇ×Ö½Ú¡£JavaÖÐ byte/char»¥×ªµÄº¯ÊýÔÚsun.ioµÄ°üÖмäÓС£ÆäÖÐByteToCharConverterÀàÊÇÖе÷¶È£¬¿ÉÒÔÓÃÀ´¸æËßÄ㣬ÄãÓÃµÄ convertor¡£ÆäÖÐÁ½¸öºÜ³£Óõľ²Ì¬º¯ÊýÊÇ£º
public static ByteToCharConverter getDefault();
public static ByteToCharConverter getConverter(String encoding);
Èç¹ûÄã²»Ö¸¶¨converter£¬Ôòϵͳ»á×Ô¶¯Ê¹Óõ±Ç°µÄencoding,gbƽ̨ÉÏÓÃgbk,enƽ̨ÉÏÓÃ8859_1¡£
byte ——¡µchar£º
"Äã"µÄgbÂëÊÇ£º0xc4e3 ,unicodeÊÇ0x4f60
String encoding = "gb2312";
byte b[] = {(byte)'\u00c4',(byte)'\u00e3'};
ByteToCharConverter converter = ByteToCharConverter.getConverter(encoding);
char c[] = converter.convertAll(b);
for (int i = 0; i < c.length; i++) {
System.out.println(Integer.toHexString(c[i]));
}
½á¹ûÊÇʲô£¿0x4f60
Èç¹ûencoding ="8859_1"£¬½á¹ûÓÖÊÇʲô£¿0x00c4,0x00e3
Èç¹û´úÂë¸ÄΪ£º
byte b[] = {(byte)'\u00c4',(byte)'\u00e3'};
ByteToCharConverter converter = ByteToCharConverter. getDefault();
char c[] = converter.convertAll(b);
for (int i = 0; i < c.length; i++) {
    System.out.println(Integer.toHexString(c[i]));
}
½á¹û½«ÓÖÊÇʲô£¿
Õâ¾ÍÒª¸ù¾Ýƽ̨µÄ±àÂë¶ø¶¨¡£
char ——¡µbyte£º
    String encoding = "gb2312";
    char c[] = {'\u4f60'};
    CharToByteConverter converter = CharToByteConverter.getConverter(encoding);
    byte b[] = converter.convertAll(c);
    for (int i = 0; i < b.length; i++) {
       System.out.println(Integer.toHexString(b[i]));
    }
½á¹ûÊÇʲô£¿0x00c4,0x00e3
Èç¹ûencoding ="8859_1"£¬½á¹ûÓÖÊÇʲô£¿0x3f
Èç¹û´úÂë¸ÄΪ
String encoding = "gb2312";
    char c[] = {'\u4f60'};
    CharToByteConverter converter = CharToByteConverter.g


Ïà¹ØÎĵµ£º

JavaÕýÔò±í´ïʽÈëÃÅ

ÖÚËùÖÜÖª£¬ÔÚ³ÌÐò¿ª·¢ÖУ¬ÄÑÃâ»áÓöµ½ÐèҪƥÅä¡¢²éÕÒ¡¢Ìæ»»¡¢ÅжÏ×Ö·û´®µÄÇé¿ö·¢Éú£¬¶øÕâЩÇé¿öÓÐʱÓֱȽϸ´ÔÓ£¬Èç¹ûÓô¿±àÂ뷽ʽ½â¾ö£¬ÍùÍù»áÀ˷ѳÌÐòÔ±µÄʱ¼ä¼°¾«Á¦¡£Òò´Ë£¬Ñ§Ï°¼°Ê¹ÓÃÕýÔò±í´ïʽ£¬±ã³ÉÁ˽â¾öÕâһì¶ÜµÄÖ÷ÒªÊֶΡ£
 ´ó¼Ò¶¼ÖªµÀ£¬ÕýÔò±í´ïʽÊÇÒ»ÖÖ¿ÉÒÔÓÃÓÚģʽƥÅäºÍÌæ»»µÄ¹æ·¶£¬Ò»¸öÕýÔò±í´ïʽ¾ÍÊÇÓÉ ......

Java×Ô¶¨ÒåÒì³£Àà

×Ô¶¨ÒåÒì³£ : ²½Öè: ­
Ò»:´´½¨Ò»¸öÀà¼Ì³ÐÓÚThrowable»òÆä×ÓÀà; ­
¶þ:Ìí¼Ó¹¹Ôì·½·¨; ­
Èý:ÔÚÒ»¸ö·½·¨ÖÐʹÓÃthrowÅ׳öÒì³£ ­
ËÄ:ÔÚÁíÒ»¸ö·½·¨Öⶻñ²¢´¦ÀíÒì³£ ­
ʾÀý:
Ò»¡¢ ¼Ì³ÐThrowable Àà
public class MySecondException extends Throwable {
public MySecondException() {
s ......

¼ÆËã»újavaѧϰÐĵÃ

Èí¼þ¿ª·¢Ö®Â·ÊdzäÂú¾£¼¬ÓëÌôս֮·,Ò²ÊdzäÂúÏ£Íû֮·¡£JavaѧϰҲÊÇÈç´Ë£¬Ã»Óнݾ¶¿É×ß¡£ÃÎÏëÏñ¡¶ÌìÁú°Ë²¿¡·ÖÐÐéÖñÒ»Ñù
±»ÎÞÑÂ×Óõ®õ­¹à¶¥¶øÇáËÉ»ñµÃÒ»¼××Ó¹¦Á¦,ÊǺܲ»ÏÖʵµÄ¡£Ã¿ÌìÑöÌì´ó½Ð"ÌìÉñ°¡£¬Çë´Í¸øÎÒÒ»±¾¿û»¨±¦µä°É"£¬
Êâ²»Öª¼´Ê¹Äã»ñµÃÁË¿û»¨±¦µä£¬³ýÁËÊÜ×Ô¹¬ÆäÉíÖ®¿àÍ⣬ÄãÒ²²»Ò»¶¨³ÉµÃÁË"¶«·½²»°Ü"£¬µ¹ÊdzÉ"Î÷· ......

java³£ÓÃÀà blobFileBean

package com.whlongyi.sys.blob.bean;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
im ......

JAVA»ñµÃÒ»¸öÊý×éµÄÖ¸¶¨³¤¶ÈµÄÅÅÁÐ

import java.util.Stack;

/**
* JAVA»ñµÃÒ»¸öÊý×éµÄÖ¸¶¨³¤¶ÈµÄÅÅÁÐ×éºÏ¡£<br>
*
* @author JAVAÊÀ¼ÍÍø(java2000.net, laozizhu.com)
*/
public class TestSequenceAll {
public static void main(String[] args) {
TestSequenceAll t = new TestSequenceAll();
Ob ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ