java InputStream 读取汉语言内容的解决乱码
java InputStream 读取中文内容的解决乱码
String suffix=file.substring(file.lastIndexOf('.')+1,file.length()); if("zip".equals(suffix)){ try { InputStream ins=new FileInputStream(new File(file)); //URLConnection .getInputStream(); ZipInputStream zipInput = new ZipInputStream(ins); ZipEntry zipEntry=null; while ((zipEntry = zipInput.getNextEntry()) != null) { //好像一定要是六才行啊 byte[] buf = new byte[6]; int len=-1; String xml=""; while ((len=zipInput.read(buf))!=-1) { xml+=new String(buf,0,len,"utf-8"); } System.out.println(xml+"\t"+xml.length()); } } catch (FileNotFoundException e) { log.info("parse zip file FileNotFoundException:"+e.getMessage()); } catch (IOException e) { log.info("parse zip file IOException:"+e.getMessage()); } } return null;
//本人不敢全部一样的哦