txt解析_java

public String queryInfoByVin(File file) {
  if(file==null){
   throw new BusinessException("file.not.fount");
  }
  String result = "";
  try {
   FileInputStream in = new FileInputStream(file);
   byte[] b = null;
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            while (in.available() != 0) {
                out.write(in.read());
            }
            b = out.toByteArray();
            if(b!=null){
             result = new String(b);
            }
            in.close();
            out.close();
  } catch (Exception e) {
   throw new BusinessException("file.not.fount");
  }
  return result;
 }

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章