标签:zip转存string java zip格式转存string
</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; }
标签:zip转存string java zip格式转存string
原文地址:http://blog.csdn.net/u012516914/article/details/39049329