本文整理了Java中org.apache.commons.compress.archivers.zip.ZipArchiveInputStream.matches()
方法的一些代码示例,展示了ZipArchiveInputStream.matches()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipArchiveInputStream.matches()
方法的具体详情如下:
包路径:org.apache.commons.compress.archivers.zip.ZipArchiveInputStream
类名称:ZipArchiveInputStream
方法名:matches
[英]Checks if the signature matches what is expected for a zip file. Does not currently handle self-extracting zips which may have arbitrary leading content.
[中]检查签名是否与zip文件的预期签名匹配。目前不处理可能包含任意前导内容的自解压拉链。
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Checks if the signature matches what is expected for a jar file
* (in this case it is the same as for a zip file).
*
* @param signature
* the bytes to check
* @param length
* the number of bytes to check
* @return true, if this stream is a jar archive stream, false otherwise
*/
public static boolean matches(final byte[] signature, final int length ) {
return ZipArchiveInputStream.matches(signature, length);
}
}
代码示例来源:origin: org.apache.commons/commons-compress
if (ZipArchiveInputStream.matches(signature, signatureLength)) {
return ZIP;
} else if (JarArchiveInputStream.matches(signature, signatureLength)) {
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Checks if the signature matches what is expected for a jar file
* (in this case it is the same as for a zip file).
*
* @param signature
* the bytes to check
* @param length
* the number of bytes to check
* @return true, if this stream is a jar archive stream, false otherwise
*/
public static boolean matches(final byte[] signature, final int length ) {
return ZipArchiveInputStream.matches(signature, length);
}
}
代码示例来源:origin: de.unkrig/de-unkrig-commons
@Override public boolean
matches(byte[] signature, int signatureLength) { return ZipArchiveInputStream.matches(signature, signatureLength); }
代码示例来源:origin: de.unkrig.commons/commons-file
@Override public boolean
matches(byte[] signature, int signatureLength) { return ZipArchiveInputStream.matches(signature, signatureLength); }
代码示例来源:origin: org.xwiki.platform/xwiki-platform-filter-stream-xar
private Boolean isZip(InputStream stream) throws IOException
{
if (!stream.markSupported()) {
// ZIP by default
return null;
}
final byte[] signature = new byte[12];
stream.mark(signature.length);
int signatureLength = stream.read(signature);
stream.reset();
return ZipArchiveInputStream.matches(signature, signatureLength);
}
}
代码示例来源:origin: org.xwiki.platform/xwiki-platform-wikistream-test
public static boolean isZip(File file) throws IOException
{
final byte[] signature = new byte[12];
FileInputStream stream = new FileInputStream(file);
stream.mark(signature.length);
int signatureLength = stream.read(signature);
stream.close();
return ZipArchiveInputStream.matches(signature, signatureLength);
}
代码示例来源:origin: org.xwiki.commons/xwiki-commons-filter-test
public static boolean isZip(File file) throws IOException
{
final byte[] signature = new byte[12];
int signatureLength;
try (FileInputStream stream = new FileInputStream(file)) {
stream.mark(signature.length);
signatureLength = stream.read(signature);
}
return ZipArchiveInputStream.matches(signature, signatureLength);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
if (ZipArchiveInputStream.matches(signature, signatureLength)) {
return ZIP;
} else if (JarArchiveInputStream.matches(signature, signatureLength)) {
内容来源于网络,如有侵权,请联系作者删除!