- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveEntry.getMethod()
方法的一些代码示例,展示了ZipArchiveEntry.getMethod()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipArchiveEntry.getMethod()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipArchiveEntry
类名称:ZipArchiveEntry
方法名:getMethod
[英]Returns the compression method of this entry, or -1 if the compression method has not been specified.
[中]返回此项的压缩方法,如果未指定压缩方法,则返回-1。
代码示例来源:origin: org.apache.commons/commons-compress
private ZipArchiveEntryRequest(final ZipArchiveEntry zipArchiveEntry, final InputStreamSupplier payloadSupplier) {
// this constructor has "safe" access to all member variables on zipArchiveEntry
this.zipArchiveEntry = zipArchiveEntry;
this.payloadSupplier = payloadSupplier;
this.method = zipArchiveEntry.getMethod();
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Whether this library supports the compression method used by
* the given entry.
*
* @return true if the compression method is supported
*/
private static boolean supportsMethodOf(final ZipArchiveEntry entry) {
return entry.getMethod() == ZipEntry.STORED
|| entry.getMethod() == ZipMethod.UNSHRINKING.getCode()
|| entry.getMethod() == ZipMethod.IMPLODING.getCode()
|| entry.getMethod() == ZipEntry.DEFLATED
|| entry.getMethod() == ZipMethod.ENHANCED_DEFLATED.getCode()
|| entry.getMethod() == ZipMethod.BZIP2.getCode();
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Ensures all bytes sent to the deflater are written to the stream.
*/
private void flushDeflater() throws IOException {
if (entry.entry.getMethod() == DEFLATED) {
streamCompressor.flushDeflater();
}
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Whether this entry requires a data descriptor this library can work with.
*
* @return true if allowStoredEntriesWithDataDescriptor is true,
* the entry doesn't require any data descriptor or the method is
* DEFLATED or ENHANCED_DEFLATED.
*/
private boolean supportsDataDescriptorFor(final ZipArchiveEntry entry) {
return !entry.getGeneralPurposeBit().usesDataDescriptor()
|| (allowStoredEntriesWithDataDescriptor && entry.getMethod() == ZipEntry.STORED)
|| entry.getMethod() == ZipEntry.DEFLATED
|| entry.getMethod() == ZipMethod.ENHANCED_DEFLATED.getCode();
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* If the mode is AsNeeded and the entry is a compressed entry of
* unknown size that gets written to a non-seekable stream then
* change the default to Never.
*
* @since 1.3
*/
private Zip64Mode getEffectiveZip64Mode(final ZipArchiveEntry ze) {
if (zip64Mode != Zip64Mode.AsNeeded
|| channel != null
|| ze.getMethod() != DEFLATED
|| ze.getSize() != ArchiveEntry.SIZE_UNKNOWN) {
return zip64Mode;
}
return Zip64Mode.Never;
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Whether the compressed size for the entry is either known or
* not required by the compression method being used.
*/
private boolean supportsCompressedSizeFor(final ZipArchiveEntry entry) {
return entry.getCompressedSize() != ArchiveEntry.SIZE_UNKNOWN
|| entry.getMethod() == ZipEntry.DEFLATED
|| entry.getMethod() == ZipMethod.ENHANCED_DEFLATED.getCode()
|| (entry.getGeneralPurposeBit().usesDataDescriptor()
&& allowStoredEntriesWithDataDescriptor
&& entry.getMethod() == ZipEntry.STORED);
}
代码示例来源:origin: org.apache.commons/commons-compress
final int method = zipArchiveEntry.getMethod();
if (method == ZipMethod.UNKNOWN_CODE) {
throw new IllegalArgumentException("Method must be set on zipArchiveEntry: " + zipArchiveEntry);
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Whether this stream is able to write the given entry.
*
* <p>May return false if it is set up to use encryption or a
* compression method that hasn't been implemented yet.</p>
* @since 1.1
*/
@Override
public boolean canWriteEntryData(final ArchiveEntry ae) {
if (ae instanceof ZipArchiveEntry) {
final ZipArchiveEntry zae = (ZipArchiveEntry) ae;
return zae.getMethod() != ZipMethod.IMPLODING.getCode()
&& zae.getMethod() != ZipMethod.UNSHRINKING.getCode()
&& ZipUtil.canHandleEntryData(zae);
}
return false;
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* @since 1.17
*/
@Override
public long getCompressedCount() {
if (current.entry.getMethod() == ZipArchiveOutputStream.STORED) {
return current.bytesRead;
} else if (current.entry.getMethod() == ZipArchiveOutputStream.DEFLATED) {
return getBytesInflated();
} else if (current.entry.getMethod() == ZipMethod.UNSHRINKING.getCode()) {
return ((UnshrinkingInputStream) current.in).getCompressedCount();
} else if (current.entry.getMethod() == ZipMethod.IMPLODING.getCode()) {
return ((ExplodingInputStream) current.in).getCompressedCount();
} else if (current.entry.getMethod() == ZipMethod.ENHANCED_DEFLATED.getCode()) {
return ((Deflate64CompressorInputStream) current.in).getCompressedCount();
} else if (current.entry.getMethod() == ZipMethod.BZIP2.getCode()) {
return ((BZip2CompressorInputStream) current.in).getCompressedCount();
} else {
return -1;
}
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Provides default values for compression method and last
* modification time.
*/
private void setDefaults(final ZipArchiveEntry entry) {
if (entry.getMethod() == -1) { // not specified
entry.setMethod(method);
}
if (entry.getTime() == -1) { // not specified
entry.setTime(System.currentTimeMillis());
}
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Writes bytes to ZIP entry.
* @param b the byte array to write
* @param offset the start position to write from
* @param length the number of bytes to write
* @throws IOException on error
*/
@Override
public void write(final byte[] b, final int offset, final int length) throws IOException {
if (entry == null) {
throw new IllegalStateException("No current entry");
}
ZipUtil.checkRequestedFeatures(entry.entry);
final long writtenThisTime = streamCompressor.write(b, offset, length, entry.entry.getMethod());
count(writtenThisTime);
}
代码示例来源:origin: org.apache.commons/commons-compress
if (current.entry.getMethod() == ZipArchiveOutputStream.STORED) {
read = readStored(buffer, offset, length);
} else if (current.entry.getMethod() == ZipArchiveOutputStream.DEFLATED) {
read = readDeflated(buffer, offset, length);
} else if (current.entry.getMethod() == ZipMethod.UNSHRINKING.getCode()
|| current.entry.getMethod() == ZipMethod.IMPLODING.getCode()
|| current.entry.getMethod() == ZipMethod.ENHANCED_DEFLATED.getCode()
|| current.entry.getMethod() == ZipMethod.BZIP2.getCode()) {
read = current.in.read(buffer, offset, length);
} else {
throw new UnsupportedZipFeatureException(ZipMethod.getMethodByCode(current.entry.getMethod()),
current.entry);
代码示例来源:origin: org.apache.commons/commons-compress
private void writeLocalFileHeader(final ZipArchiveEntry ze, final boolean phased) throws IOException {
final boolean encodable = zipEncoding.canEncode(ze.getName());
final ByteBuffer name = getName(ze);
if (createUnicodeExtraFields != UnicodeExtraFieldPolicy.NEVER) {
addUnicodeExtraFields(ze, encodable, name);
}
final long localHeaderStart = streamCompressor.getTotalBytesWritten();
final byte[] localHeader = createLocalFileHeader(ze, name, encodable, phased, localHeaderStart);
metaData.put(ze, new EntryMetaData(localHeaderStart, usesDataDescriptor(ze.getMethod(), phased)));
entry.localDataStart = localHeaderStart + LFH_CRC_OFFSET; // At crc offset
writeCounted(localHeader);
entry.dataStart = streamCompressor.getTotalBytesWritten();
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Checks whether the entry requires features not (yet) supported
* by the library and throws an exception if it does.
*/
static void checkRequestedFeatures(final ZipArchiveEntry ze)
throws UnsupportedZipFeatureException {
if (!supportsEncryptionOf(ze)) {
throw
new UnsupportedZipFeatureException(UnsupportedZipFeatureException
.Feature.ENCRYPTION, ze);
}
if (!supportsMethodOf(ze)) {
final ZipMethod m = ZipMethod.getMethodByCode(ze.getMethod());
if (m == null) {
throw
new UnsupportedZipFeatureException(UnsupportedZipFeatureException
.Feature.METHOD, ze);
}
throw new UnsupportedZipFeatureException(m, ze);
}
}
}
代码示例来源:origin: org.apache.commons/commons-compress
&& getPlatform() == other.getPlatform()
&& getExternalAttributes() == other.getExternalAttributes()
&& getMethod() == other.getMethod()
&& getSize() == other.getSize()
&& getCrc() == other.getCrc()
代码示例来源:origin: org.apache.commons/commons-compress
} else if (entry.entry.getMethod() == STORED
&& entry.entry.getSize() != ArchiveEntry.SIZE_UNKNOWN) {
if (entry.entry.getMethod() == DEFLATED && hasCompressionLevelChanged) {
def.setLevel(level);
hasCompressionLevelChanged = false;
代码示例来源:origin: org.apache.commons/commons-compress
final Zip64Mode effectiveMode)
throws ZipException {
if (entry.entry.getMethod() == DEFLATED) {
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Throws an exception if the size is unknown for a stored entry
* that is written to a non-seekable output or the entry is too
* big to be written without Zip64 extra but the mode has been set
* to Never.
*/
private void validateSizeInformation(final Zip64Mode effectiveMode)
throws ZipException {
// Size/CRC not required if SeekableByteChannel is used
if (entry.entry.getMethod() == STORED && channel == null) {
if (entry.entry.getSize() == ArchiveEntry.SIZE_UNKNOWN) {
throw new ZipException("uncompressed size is required for"
+ " STORED method when not writing to a"
+ " file");
}
if (entry.entry.getCrc() == ZipArchiveEntry.CRC_UNKNOWN) {
throw new ZipException("crc checksum is required for STORED"
+ " method when not writing to a file");
}
entry.entry.setCompressedSize(entry.entry.getSize());
}
if ((entry.entry.getSize() >= ZIP64_MAGIC
|| entry.entry.getCompressedSize() >= ZIP64_MAGIC)
&& effectiveMode == Zip64Mode.Never) {
throw new Zip64RequiredException(Zip64RequiredException
.getEntryTooBigMessage(entry.entry));
}
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Writes the data descriptor entry.
* @param ze the entry to write
* @throws IOException on error
*/
protected void writeDataDescriptor(final ZipArchiveEntry ze) throws IOException {
if (!usesDataDescriptor(ze.getMethod(), false)) {
return;
}
writeCounted(DD_SIG);
writeCounted(ZipLong.getBytes(ze.getCrc()));
if (!hasZip64Extra(ze)) {
writeCounted(ZipLong.getBytes(ze.getCompressedSize()));
writeCounted(ZipLong.getBytes(ze.getSize()));
} else {
writeCounted(ZipEightByteInteger.getBytes(ze.getCompressedSize()));
writeCounted(ZipEightByteInteger.getBytes(ze.getSize()));
}
}
代码示例来源:origin: org.apache.commons/commons-compress
writeOut(ZipShort.getBytes(versionNeededToExtract(entry.entry.getMethod(), false, false)));
有没有办法从 archive.org 上传或触发自己网站的快照到 WayBackMachine?我已经检查了常见问题解答和 archive.org API,但找不到任何使用脚本触发此问题的方法。 最佳
在我当前的项目中,我正在集成 RestKit 库(我不知道它是否重要),当我使用编译器提示的“存档”时尝试交付应用程序进行测试 "RestKit/RestKit.h" is not found 在构
在我的项目开始时,有两个 terraform 模块:base 和 reusable_module。 base/main.tf # Provide abstraction to define a lam
我试图弄清楚如何以正确的方式构建我的 Cocoa 应用程序的发布版本。 到目前为止,我已经使用了 为归档而构建 选项,并从 Xcode 的 DerivedData 文件夹深处获取应用程序包。 今天我试
我有一个 Swift 语言的 iOS 项目,我必须在终端上使用命令创建存档和 .ipa。 我正在使用 Github 操作在试飞中上传 iOS 版本。 我正在遵循此链接中提到的所有说明: https:/
我正在使用 GCC 从两个 *.a(静态库)创建一个共享对象库。我引用了这些文章: How to force gcc to link an unused static library How to i
我的应用程序突然停止创建 iOS App Archive,而是开始创建 Xcode Generic Archive。 这是在为我的应用程序的新版本进行更改后发生的,我添加了逻辑、UI 更改和一些新框架
我有一个包含大约 800 个 .tgz 文件的目录,每个文件包含大约 10 个文件。实际上,我想将每个存档转换为同名目录。是否有一个简单的一行命令来执行此操作,还是我应该编写一个脚本? 最佳答案 自
在 gcc 中使用 -Wl--whole-archive ... -Wl--no-whole-archive 标志时,您如何验证库内部的所有内容都正确链接?另外,您如何验证该库是否可以调用由 LD_L
我有一个用 Swift 编写的小型命令行应用程序,现在我想将其归档。然而,像我之前的许多其他人一样,我遇到了如何将 Archive Type 从 Generic Xcode Archive 更改为 M
我不确定是否应该对 .emacs.d 下的以下文件进行版本控制: [lucas@lucas-ThinkPad-W520]/home/lucas/.emacs.d$ file elpa/archives
我正在处理 Postgres DVD tutorial并且在导入示例数据库时遇到问题。 运行 pg_restore -U postgres -d dvdrental ~[filepath]/dvd-d
注意: Boost 的存档方案基于对称的输入和输出存档类。一直写这两者很乏味,所以我将使用 ?archive 来表示 oarchive 和 iarchive。 总结: 将自定义存档的基类从 binar
是否可以使用 Node.js 流构建一个 zip 存档,并在创建时通过对 HTTP GET 请求的响应将该 zip 存档提供给客户端/用户?我正在寻找一种最好避免将整个 zip 缓冲到服务器内存中的解
我正在尝试使用 XCODE 4.3.1 发布一个临时 ipa。归档我的 iOS 应用程序时,我可以在管理器中看到归档类型是“Mac App Archive”,虽然我知道它应该是“iOS App Arc
我正在参加 Udacity 的类(class),该类(class)要求我在我的系统上设置虚拟机。我已经下载并安装了 Virtual Box 和 Vagrant。当我尝试运行命令 vagrant up
我试图找到一个很好的例子来说明如何使用这些二进制宽字符版本的 boost 序列化内容。我拼凑了一些代码来尝试让它工作,但不幸的是,我在尝试编译它时遇到了链接器错误的轰炸。 这是我的代码,以防我做任何明
目标与问题 我在 IntelliJ 中创建了一个 Java 程序。我按照说明将其构建为 .jar 文件 here 。当我尝试运行它时,它给出以下输出: Parameters: archive-name
我已包含在 hector-core-1.1-2 文件夹中找到的所有 jar。还有其他我没有包含的 jar 吗?我尝试过的事情。1)清除netbeans缓存2)下载org.apache.xbean.fi
我正在尝试打开包含创建数据库和 INSERT 语句的 PostgreSQL 的 SQL 脚本(.sql 文件),但是当我尝试使用 PgAdmin 4 恢复数据库时,它给我错误提示“pg_restore
我是一名优秀的程序员,十分优秀!