本文整理了Java中de.schlichtherle.truezip.zip.ZipOutputStream.putNextEntry()
方法的一些代码示例,展示了ZipOutputStream.putNextEntry()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipOutputStream.putNextEntry()
方法的具体详情如下:
包路径:de.schlichtherle.truezip.zip.ZipOutputStream
类名称:ZipOutputStream
方法名:putNextEntry
暂无
代码示例来源:origin: digital-preservation/droid
@SuppressWarnings("unchecked")
@Override
protected void handleFile(final File file, final int depth, final Collection results)
throws IOException {
final String entryPath = getUnixStylePath(StringUtils.substringAfter(file.getAbsolutePath(), source.toAbsolutePath().toString() + File.separator));
//ZipArchiveEntry entry = (ZipArchiveEntry) out.createArchiveEntry(file, entryPath);
//out.putArchiveEntry(entry);
final ZipEntry entry = new ZipEntry(entryPath);
out.putNextEntry(entry);
try (final InputStream in = new BufferedInputStream(Files.newInputStream(file.toPath()))) {
bytesProcessed = writeFile(in, out, callback, bytesProcessed, bytesToProcess);
} finally {
//out.closeArchiveEntry();
out.closeEntry();
}
}
代码示例来源:origin: uk.gov.nationalarchives/droid-results
@SuppressWarnings("unchecked")
@Override
protected void handleFile(File file, int depth, Collection results)
throws IOException {
String entryPath = getUnixStylePath(StringUtils.substringAfter(file
.getAbsolutePath(), sourcePath));
//ZipArchiveEntry entry = (ZipArchiveEntry) out.createArchiveEntry(file, entryPath);
//out.putArchiveEntry(entry);
ZipEntry entry = new ZipEntry(entryPath);
out.putNextEntry(entry);
final BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
try {
bytesProcessed = writeFile(in, out, callback, bytesProcessed, bytesToProcess);
} finally {
//out.closeArchiveEntry();
out.closeEntry();
in.close();
}
}
代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip
@Test
public final void testGoodGetCheckedInputStream() throws IOException {
// Create test ZIP file.
final String name = "entry";
final ZipOutputStream zipOut
= newZipOutputStream(new FileOutputStream(file));
zipOut.putNextEntry(newEntry(name));
zipOut.write(data);
zipOut.close();
final ZipFile zipIn = newZipFile(file);
// Open checked input stream and join immediately.
InputStream in = zipIn.getCheckedInputStream(name);
in.close();
// Open checked input stream and read fully, using multiple methods.
in = zipIn.getCheckedInputStream(name);
final int n = data.length / 4;
in.skip(n);
in.read(new byte[n]);
in.read(new byte[n], 0, n);
while (in.read() != -1) { // read until EOF
}
in.close();
zipIn.close();
}
代码示例来源:origin: pl.edu.icm.cocos/cocos-services
String fileName = getFilename(filetype, fileNumber);
ZipEntry newEntry = new ZipEntry(fileName);
zipOutputStream.putNextEntry(newEntry);
final InputStream is = fileResource.getInputStream();
IOUtils.copy(is, zipOutputStream);
代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip
@Test
public final void testWriteAndReadSingleBytes() throws IOException {
final ZipOutputStream zipOut
= newZipOutputStream(new FileOutputStream(file));
zipOut.putNextEntry(newEntry("file"));
for (int i = 0; i < data.length; i++)
zipOut.write(data[i]);
zipOut.close();
final ZipFile zipIn = newZipFile(file);
InputStream in = zipIn.getInputStream("file");
for (int i = 0, c; (c = in.read()) != -1; i++)
assertEquals(data[i] & 0xFF, c);
in.close();
zipIn.close();
}
代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip
private void append(
final int off,
final int len,
final byte[] data)
throws IOException {
final ZipOutputStream out;
if (file.exists()) {
final ZipFile in = newZipFile(file);
in.close();
out = newZipOutputStream(new FileOutputStream(file, true), in);
} else {
out = newZipOutputStream(new FileOutputStream(file));
}
try {
for (int i = 0; i < len; i++) {
final String name = off + i + ".txt";
out.putNextEntry(newEntry(name));
out.write(data);
}
} finally {
out.close();
}
}
}
代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip
new FileOutputStream(file));
try {
zipOut.putNextEntry(newEntry(name));
zipOut.write(data);
} finally {
代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip
@Test
public final void testGetInputStream() throws IOException {
final ZipOutputStream zipOut
= newZipOutputStream(new FileOutputStream(file));
try {
zipOut.putNextEntry(newEntry("foo"));
} finally {
zipOut.close();
}
final ZipFile zipIn = newZipFile(file);
try {
zipIn.getInputStream("foo").close();
assertNull(zipIn.getInputStream("bar"));
} finally {
zipIn.close();
}
}
代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip
for (int i = 0; i < nEntries; i++) {
String name = i + ".txt";
zout.putNextEntry(newEntry(name));
zout.write(data);
assertTrue(set.add(name));
代码示例来源:origin: de.schlichtherle.truezip/truezip-driver-zip
entry.setMethod(STORED);
zos.putNextEntry(entry);
zos.write(data);
assertTrue(set.add(name));
内容来源于网络,如有侵权,请联系作者删除!