mkdirs(p); try (InputStream input = zip.getInputStream(e)) { IOUtils.copy(input, writing(f));
.fromJarURI(uri), "UTF-8"); inputStream = zf.getInputStream(zf.getEntry(uri.substring(pling + 2))); } else { URLConnection conn = url.openConnection();
try { extractFile(fileUtils, srcF, dir, is = zf.getInputStream(ze), //NOSONAR ze.getName(), new Date(ze.getTime()), ze.isDirectory(), mapper);
/** * Add a file entry. */ private void addResource(final Resource r, final String name, final String prefix, final ZipOutputStream zOut, final int mode, final ZipFile zf, final File fromArchive) throws IOException { if (zf != null) { final ZipEntry ze = zf.getEntry(r.getName()); if (ze != null) { final boolean oldCompress = doCompress; if (keepCompression) { doCompress = (ze.getMethod() == ZipEntry.DEFLATED); } try (final BufferedInputStream is = new BufferedInputStream(zf.getInputStream(ze))) { zipFile(is, zOut, prefix + name, ze.getTime(), fromArchive, mode, ze.getExtraFields(true)); } finally { doCompress = oldCompress; } } } else { try (final BufferedInputStream is = new BufferedInputStream(r.getInputStream())) { zipFile(is, zOut, prefix + name, r.getLastModified(), fromArchive, mode, r instanceof ZipResource ? ((ZipResource) r).getExtraFields() : null); } } }
+ getArchive()); return new FilterInputStream(z.getInputStream(ze)) { public void close() throws IOException { FileUtils.close(in);
if (!targetFile.exists() || overwrite) { targetFile.getParentFile().mkdirs(); try (InputStream inputStream = zipFile.getInputStream(zipEntry); FileOutputStream outputStream = new FileOutputStream(targetFile); FileLock fileLock = outputStream.getChannel().tryLock();) {
if (!targetFile.exists() || overwrite) { targetFile.getParentFile().mkdirs(); try (InputStream inputStream = zipFile.getInputStream(zipEntry); FileOutputStream outputStream = new FileOutputStream(targetFile); FileLock fileLock = outputStream.getChannel().tryLock();) {
private byte[] getDataFromZipFileEntry(ZipFile zipFile, ZipEntry entry) throws IOException { InputStream zis = zipFile.getInputStream(entry); ByteArrayOutputStream bos = new ByteArrayOutputStream(); byte[] buf = new byte[1024]; int len; while ((len = zis.read(buf)) > 0) { bos.write(buf, 0, len); } byte[] data = bos.toByteArray(); bos.close(); return data; }
public InputStream open() { try { return zip.getInputStream(entry); } catch (IOException e) { throw new UncheckedIOException(e); } }
private static Map<ZipEntry, byte[]> readZipAllEntry(ZipFile file) throws Exception { Map<ZipEntry, byte[]> entryMaps = new HashMap<ZipEntry, byte[]>(); Enumeration<? extends ZipEntry> entries = file.getEntries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); int len = -1; byte[] data = new byte[512]; InputStream istream = file.getInputStream(entry); ByteArrayOutputStream bos = new ByteArrayOutputStream(); while ((len = istream.read(data, 0, 512)) != -1) { bos.write(data, 0, len); } bos.close(); istream.close(); byte[] result = bos.toByteArray(); entryMaps.put(entry, result); } return entryMaps; } }
inputStream = zipFile.getInputStream(entry); fileOut = new FileOutputStream(destFile); byte[] buf = new byte[bufSize];
ZipEntry entry = (ZipEntry) entries.nextElement(); String zipEntryName = entry.getName(); InputStream in = zip.getInputStream(entry); String outPath = (descDir + zipEntryName).replaceAll("\\*", "/"); outPath = new String(outPath.getBytes("utf-8"), "ISO8859-1");
inputStream = zf.getInputStream(entry);
inputStream = zipFile.getInputStream(zipEntry); fileOut = new FileOutputStream(file); while ((readedBytes = inputStream.read(buf)) > 0) {
new FileOutputStream(decompressDir + "/" + entryName)); bi = new BufferedInputStream(zf.getInputStream(ze2)); byte[] readContent = new byte[1024]; int readCount = bi.read(readContent);
} else { is = zipFile.getInputStream((ZipEntry) zipEnt); bis = new BufferedInputStream(is); gbkPath = zipEnt.getName();
is = zipFile.getInputStream(entry); fos = new FileOutputStream(file); bos = new BufferedOutputStream(fos, buffer);
inputStream = zf.getInputStream(entry);
private static void unzipToDirectory(ZipFile zipFile, File destDir) throws IOException { byte[] buffer = new byte[4096]; Enumeration entries = zipFile.getEntries(); while (entries.hasMoreElements()) { ZipEntry entry = (ZipEntry) entries.nextElement(); if (entry.isDirectory()) { File dir = new File(destDir, entry.getName()); InstallUtils.createDirectory(dir); } else { File file = new File(destDir, entry.getName()); InstallUtils.createDirectory(file.getParentFile()); OutputStream out = null; InputStream in = null; try { out = new BufferedOutputStream(new FileOutputStream(file)); in = zipFile.getInputStream(entry); Unzip.copy(in, out, buffer); } finally { InstallUtils.close(in); InstallUtils.close(out); } Unzip.setFilePermissions(file, entry); } } }
mkdirs(p); try (InputStream input = zip.getInputStream(e)) { IOUtils.copy(input, writing(f));