read GBK code from bytes,string operations

原创 2006年06月10日 11:10:00
  byte b[]  = new byte[256];
  sfile.readFully( b,0,256);
  nFileName="";
  String tempStr=new String(b,"GBK");
  
  for (int ii=0;ii<tempStr.length();ii++){
   if (!((int)tempStr.charAt(ii)==0)){
   nFileName=nFileName+tempStr.charAt(ii);
   }else{
    break;
   }
  }

相关文章推荐

ubifs烧写遇到《UBI error: ubi_io_read: error -1 while reading 64 bytes from PEB》

终于移植好了2.6.39的内核,烧写ubi文件系统后,第一次打印到/init初始化了,虽然oops了,但还是感觉离最后的成功越来越近了。 可是,偶然断电重启发现,debug口打印却和第一次不一样了,在...

mysql Can not read response from server. Expected to read 4 bytes 异常

http://stackoverflow.com/questions/13950496/what-is-java-io-eofexception-message-can-not-read-respon...

[Erlang 0021] From String To Erlang Code

团队的兄弟遇到一个问题,如何把字符串动态解析成为Erlang数据结构(Erlang term)? 比如"[{1,2},{2,3},{3,4}]"转成[{1,2},{2,3},{3,4}] From ...

STL std:string引起的User breakpoint exception/User breakpoint called from code at

STL std:string引起的User breakpoint exception/User breakpoint called from code at ...
  • lionzl
  • lionzl
  • 2011年07月05日 15:54
  • 521

[转]STL std:string引起的User breakpoint exception/User breakpoint called from code at

SYMPTOMS:  程序崩溃,弹出 User breakpoint called from code at 0x????????对话框;  崩溃时的调用栈有如下几种常见情形: (1) TDL...

Python中遇到"UnicodeDecodeError: ‘gbk’ codec can’t decode bytes in position 2-3: illegal multibyte sequ

【背景】 问题参见: python2.7 urllib2 抓取新浪乱码 中的: 报错的异常是    UnicodeDecodeError: ‘gbk’ c...

web服务连接mysql报错 解析:Can not read response from server. Expected to read 4 bytes, read 0 bytes before c

报错内容: The last packet successfully received from the server was 3,087,649 milliseconds ago.  The la...

Python中遇到"UnicodeDecodeError: ‘gbk’ codec can’t decode bytes in position 2-3: illegal multibyte sequ

源地址:http://www.crifan.com/summary_python_unicodedecode_error_possible_reasons_and_solutions/ ...

Python中遇到"UnicodeDecodeError: ‘gbk’ codec can’t decode bytes in position 2-3: illegal multibyte sequ

【背景】 问题参见: python2.7 urllib2 抓取新浪乱码 中的: 报错的异常是    UnicodeDecodeError: ‘gbk’ codec can’t deco...
  • YMD8005
  • YMD8005
  • 2016年04月01日 09:04
  • 637
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:read GBK code from bytes,string operations
举报原因:
原因补充:

(最多只允许输入30个字)