代码语言:javascript复制
</pre><pre name="code" class="java"><pre name="code" class="java"><pre name="code" class="java">public static StringBuffer readZipFile(File file) throws Exception {
StringBuffer html = new StringBuffer();
ZipFile zf = new ZipFile(file);
Enumeration<? extends ZipEntry> zipEntry = zf.entries();
ZipEntry ze;
while (zipEntry.hasMoreElements()) {
ze = zipEntry.nextElement();
if (ze.isDirectory()) {
} else {
long size = ze.getSize();
if (size > 0) {
BufferedReader br = new BufferedReader(
new InputStreamReader(zf.getInputStream(ze)));
String line;
while ((line = br.readLine()) != null) {
html.append(line);
}
br.close();
}
}
}
return html;
}
代码语言:javascript复制