大道致远
前途漫漫
posts - 4,comments - 0,trackbacks - 0

 

 1 public  String decode(ByteBuffer buffer)
 2 {
 3         System.out.println( " buffer= "   +  buffer);
 4         Charset charset  =   null ;
 5         CharsetDecoder decoder  =   null ;
 6         CharBuffer charBuffer  =   null ;
 7          try
 8      {
 9             charset  =  Charset.forName( " gb2312 " );
10             decoder  =  charset.newDecoder();
11             charBuffer  =  decoder.decode(buffer);
12             System.out.println( " charBuffer= "   +  charBuffer);
13             System.out.println(charBuffer.toString());
14              return  charBuffer.toString();
15         }

16          catch  (Exception ex)
17      {
18             ex.printStackTrace();
19              return   "" ;
20         }

21  }
posted on 2007-01-31 15:02 wyg405 阅读(6642) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: