本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.canReadEntryData()
方法的一些代码示例,展示了ZipArchiveInputStream.canReadEntryData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipArchiveInputStream.canReadEntryData()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
类名称:ZipArchiveInputStream
方法名:canReadEntryData
[英]Whether this class is able to read the given entry.
May return false if it is set up to use encryption or a compression method that hasn't been implemented yet.
[中]该类是否能够读取给定的条目。
如果设置为使用尚未实现的加密或压缩方法,则可能返回false。
代码示例来源:origin: apache/tika
while (zae != null) {
try {
if (!zae.isDirectory() && zipArchiveInputStream.canReadEntryData(zae)) {
outputStream.putArchiveEntry(zae);
代码示例来源:origin: stackoverflow.com
ZipFile zipFile = new ZipFile("C:\\test.zip");
byte[] buf = new byte[65536];
Enumeration<?> entries = zipFile.getEntries();
while (entries.hasMoreElements()) {
ZipArchiveEntry zipArchiveEntry = (ZipArchiveEntry) entries.nextElement();
int n;
InputStream is = zipFile.getInputStream(zipArchiveEntry);
ZipArchiveInputStream zis = new ZipArchiveInputStream(is);
if (zis.canReadEntryData(zipArchiveEntry)) {
while ((n = is.read(buf)) != -1) {
if (n > 0) {
System.out.println(new String(buf));
}
}
}
zis.close();
}
代码示例来源:origin: de.flapdoodle.embedmongo/de.flapdoodle.embedmongo
while ((entry = zipIn.getNextZipEntry()) != null) {
if (file.matcher(entry.getName()).matches()) {
if (zipIn.canReadEntryData(entry)) {
long size = entry.getSize();
Files.write(zipIn, size, destination);
代码示例来源:origin: michaelmosmann/embedmongo.flapdoodle.de
if (file.matcher(entry.getName()).matches()) {
if (zipIn.canReadEntryData(entry)) {
代码示例来源:origin: org.xwiki.platform/xwiki-platform-xar-model
/**
* Find and add the entries located in the passed XAR file.
*
* @param xarStream an input stream to a XAR file
* @throws IOException when failing to read the file
* @throws XarException when failing to parse the XAR package
*/
public void read(InputStream xarStream) throws IOException, XarException
{
ZipArchiveInputStream zis = new ZipArchiveInputStream(xarStream, "UTF-8", false);
try {
for (ZipArchiveEntry entry = zis.getNextZipEntry(); entry != null; entry = zis.getNextZipEntry()) {
if (!entry.isDirectory() && zis.canReadEntryData(entry)) {
readEntry(zis, entry.getName());
}
}
} finally {
zis.close();
}
}
内容来源于网络,如有侵权,请联系作者删除!