// 构造zip输入流
ZipInputStream zip = new ZipInputStream(fis,Charset.forName("gbk"));
byte[] tmpByte = null;
ZipEntry tmpEntity = null;
while ( (tmpEntity = zip.getNextEntry()) != null) {
byte[] buf = new byte[1024];
int num = -1;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
logger.info("####file_name:"+tmpEntity.getName());
while ((num = zip.read(buf, 0, buf.length)) != -1) {
baos.write(buf, 0, num);
}
tmpByte = baos.toByteArray();
baos.flush();
baos.close();
// 处理转换文件
handelCheckFile(tmpEntity.getName(),tmpByte);
}
zip.close();
fis.close();
===============================================================
private void handelCheckFile(String fileName ,byte[] tmpByte) {
InputStream inputStream = new ByteArrayInputStream(tmpByte);
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream,Charset.forName("gbk")));
String line;
int num = 0;
// 循环解析文件
try {
logger.info("##下载文件名称fileName:"+fileName);
while ((line = br.readLine()) != null) {
logger.info(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}