- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中java.util.zip.ZipException.<init>()
方法的一些代码示例,展示了ZipException.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipException.<init>()
方法的具体详情如下:
包路径:java.util.zip.ZipException
类名称:ZipException
方法名:<init>
[英]Constructs a new ZipException instance.
[中]构造一个新的ZipException实例。
代码示例来源:origin: Tencent/tinker
static void throwZipException(String filename, long fileSize, String entryName, long localHeaderRelOffset, String msg, int magic) throws ZipException {
final String hexString = Integer.toHexString(magic);
throw new ZipException("file name:" + filename
+ ", file size" + fileSize
+ ", entry name:" + entryName
+ ", entry localHeaderRelOffset:" + localHeaderRelOffset
+ ", "
+ msg + " signature not found; was " + hexString);
}
代码示例来源:origin: org.apache.ant/ant
/**
* Populate data from this array as if it was in local file data.
* @param data an array of bytes
* @param offset the start offset
* @param length the number of bytes in the array from offset
*
* @throws ZipException on error
*/
public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
if (length != 0) {
throw new ZipException("JarMarker doesn't expect any data");
}
}
}
代码示例来源:origin: pxb1988/dex2jar
static void throwZipException(String msg, int magic) throws ZipException {
final String hexString = String.format("0x%08x", magic);
throw new ZipException(msg + " signature not found; was " + hexString);
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Populate data from this array as if it was in local file data.
* @param data an array of bytes
* @param offset the start offset
* @param length the number of bytes in the array from offset
*
* @throws ZipException on error
*/
@Override
public void parseFromLocalFileData(final byte[] data, final int offset, final int length)
throws ZipException {
if (length != 0) {
throw new ZipException("JarMarker doesn't expect any data");
}
}
代码示例来源:origin: alibaba/mdrill
/**
* Populate data from this array as if it was in local file data.
* @param data an array of bytes
* @param offset the start offset
* @param length the number of bytes in the array from offset
*
* @throws ZipException on error
*/
public void parseFromLocalFileData(byte[] data, int offset, int length)
throws ZipException {
if (length != 0) {
throw new ZipException("JarMarker doesn't expect any data");
}
}
}
代码示例来源:origin: robovm/robovm
private void write() throws IOException, ZipException {
try {
int inflated;
while ((inflated = inf.inflate(buf)) > 0) {
out.write(buf, 0, inflated);
}
} catch (DataFormatException e) {
throw new ZipException();
}
}
代码示例来源:origin: org.apache.commons/commons-compress
@Override
public void parseFromLocalFileData(final byte[] buffer, final int offset, final int length)
throws ZipException {
if (length < 5) {
throw new ZipException("UniCode path extra data must have at least 5 bytes.");
}
final int version = buffer[offset];
if (version != 0x01) {
throw new ZipException("Unsupported version [" + version
+ "] for UniCode path extra data.");
}
nameCRC32 = ZipLong.getValue(buffer, offset + 1);
unicodeName = new byte[length - 5];
System.arraycopy(buffer, offset + 5, unicodeName, 0, length - 5);
data = null;
}
代码示例来源:origin: org.apache.ant/ant
/** {@inheritDoc} */
public void parseFromLocalFileData(final byte[] buffer, final int offset, final int length)
throws ZipException {
if (length < 5) {
throw new ZipException("UniCode path extra data must have at least"
+ " 5 bytes.");
}
final int version = buffer[offset];
if (version != 0x01) {
throw new ZipException("Unsupported version [" + version
+ "] for UniCode path extra data.");
}
nameCRC32 = ZipLong.getValue(buffer, offset + 1);
unicodeName = new byte[length - 5];
System.arraycopy(buffer, offset + 5, unicodeName, 0, length - 5);
data = null;
}
代码示例来源:origin: org.apache.ant/ant
/**
* Searches for the and positions the stream at the start of the
* "End of central dir record".
*/
private void positionAtEndOfCentralDirectoryRecord()
throws IOException {
final boolean found = tryToLocateSignature(MIN_EOCD_SIZE, MAX_EOCD_SIZE,
ZipOutputStream.EOCD_SIG);
if (!found) {
throw new ZipException("archive is not a ZIP archive");
}
}
代码示例来源:origin: alibaba/mdrill
/**
* Searches for the and positions the stream at the start of the
* "End of central dir record".
*/
private void positionAtEndOfCentralDirectoryRecord()
throws IOException {
boolean found = tryToLocateSignature(MIN_EOCD_SIZE, MAX_EOCD_SIZE,
ZipOutputStream.EOCD_SIG);
if (!found) {
throw new ZipException("archive is not a ZIP archive");
}
}
代码示例来源:origin: alibaba/mdrill
/**
* Searches for the and positions the stream at the start of the
* "End of central dir record".
*/
private void positionAtEndOfCentralDirectoryRecord()
throws IOException {
boolean found = tryToLocateSignature(MIN_EOCD_SIZE, MAX_EOCD_SIZE,
ZipOutputStream.EOCD_SIG);
if (!found) {
throw new ZipException("archive is not a ZIP archive");
}
}
代码示例来源:origin: org.apache.commons/commons-compress
@Override
public void parseFromCentralDirectoryData(byte[] buffer, int offset, int length) throws ZipException {
if (length < BASE_SIZE) {
throw new ZipException("Too short content for ResourceAlignmentExtraField (0xa11e): " + length);
}
int alignmentValue = ZipShort.getValue(buffer, offset);
this.alignment = (short) (alignmentValue & (ALLOW_METHOD_MESSAGE_CHANGE_FLAG - 1));
this.allowMethodChange = (alignmentValue & ALLOW_METHOD_MESSAGE_CHANGE_FLAG) != 0;
}
}
代码示例来源:origin: org.apache.commons/commons-compress
/**
* Searches for the and positions the stream at the start of the
* "End of central dir record".
*/
private void positionAtEndOfCentralDirectoryRecord()
throws IOException {
final boolean found = tryToLocateSignature(MIN_EOCD_SIZE, MAX_EOCD_SIZE,
ZipArchiveOutputStream.EOCD_SIG);
if (!found) {
throw new ZipException("archive is not a ZIP archive");
}
}
代码示例来源:origin: robovm/robovm
static void throwZipException(String msg, int magic) throws ZipException {
final String hexString = IntegralToString.intToHexString(magic, true, 8);
throw new ZipException(msg + " signature not found; was " + hexString);
}
代码示例来源:origin: Tencent/tinker
/**
* Writes data for the current entry to the underlying stream.
*
* @throws IOException
* If an error occurs writing to the stream
*/
@Override
public void write(byte[] buffer, int offset, int byteCount) throws IOException {
Arrays.checkOffsetAndCount(buffer.length, offset, byteCount);
if (currentEntry == null) {
throw new ZipException("No active entry");
}
/*final long totalBytes = crc.tbytes + byteCount;
if ((totalBytes > Zip64.MAX_ZIP_ENTRY_AND_ARCHIVE_SIZE) && !currentEntryNeedsZip64) {
throw new IOException("Zip entry size (" + totalBytes +
" bytes) cannot be represented in the zip format (needs Zip64)." +
" Set the entry length using ZipEntry#setLength to use Zip64 where necessary.");
}*/
if (currentEntry.getMethod() == STORED) {
out.write(buffer, offset, byteCount);
} else {
out.write(buffer, offset, byteCount);
}
// crc.update(buffer, offset, byteCount);
}
private void checkOpen() throws IOException {
代码示例来源:origin: neo4j/neo4j
public Callables loadProceduresFromDir( File root ) throws IOException, KernelException
{
if ( root == null || !root.exists() )
{
return Callables.empty();
}
Callables out = new Callables();
File[] dirListing = root.listFiles( ( dir, name ) -> name.endsWith( ".jar" ) );
if ( dirListing == null )
{
return Callables.empty();
}
if ( !allJarFilesAreValidZipFiles( Stream.of( dirListing ) ) )
{
throw new ZipException( "Some jar procedure files are invalid, see log for details." );
}
URL[] jarFilesURLs = Stream.of( dirListing ).map( this::toURL ).toArray( URL[]::new );
URLClassLoader loader = new URLClassLoader( jarFilesURLs, this.getClass().getClassLoader() );
for ( URL jarFile : jarFilesURLs )
{
loadProcedures( jarFile, loader, out );
}
return out;
}
代码示例来源:origin: robovm/robovm
private void readAndVerifyDataDescriptor(int inB, int out) throws IOException {
if (hasDD) {
Streams.readFully(in, hdrBuf, 0, EXTHDR);
int sig = Memory.peekInt(hdrBuf, 0, ByteOrder.LITTLE_ENDIAN);
if (sig != (int) EXTSIG) {
throw new ZipException(String.format("unknown format (EXTSIG=%x)", sig));
}
currentEntry.crc = ((long) Memory.peekInt(hdrBuf, EXTCRC, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL;
currentEntry.compressedSize = ((long) Memory.peekInt(hdrBuf, EXTSIZ, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL;
currentEntry.size = ((long) Memory.peekInt(hdrBuf, EXTLEN, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL;
}
if (currentEntry.crc != crc.getValue()) {
throw new ZipException("CRC mismatch");
}
if (currentEntry.compressedSize != inB || currentEntry.size != out) {
throw new ZipException("Size mismatch");
}
}
代码示例来源:origin: Tencent/tinker
throw new ZipException("No entries");
代码示例来源:origin: Tencent/tinker
centralDirOffset = ((long) it.readInt()) & 0xffffffffL;
if (numEntries != totalNumEntries || diskNumber != 0 || diskWithCentralDir != 0) {
throw new ZipException("Spanned archives not supported");
代码示例来源:origin: Tencent/tinker
int gpbf = it.readShort() & 0xffff;
if ((gpbf & TinkerZipFile.GPBF_UNSUPPORTED_MASK) != 0) {
throw new ZipException("Invalid General Purpose Bit Flag: " + gpbf);
Streams.readFully(cdStream, nameBytes, 0, nameBytes.length);
if (containsNulByte(nameBytes)) {
throw new ZipException("Filename contains NUL byte: " + Arrays.toString(nameBytes));
我想了解 Ruby 方法 methods() 是如何工作的。 我尝试使用“ruby 方法”在 Google 上搜索,但这不是我需要的。 我也看过 ruby-doc.org,但我没有找到这种方法。
Test 方法 对指定的字符串执行一个正则表达式搜索,并返回一个 Boolean 值指示是否找到匹配的模式。 object.Test(string) 参数 object 必选项。总是一个
Replace 方法 替换在正则表达式查找中找到的文本。 object.Replace(string1, string2) 参数 object 必选项。总是一个 RegExp 对象的名称。
Raise 方法 生成运行时错误 object.Raise(number, source, description, helpfile, helpcontext) 参数 object 应为
Execute 方法 对指定的字符串执行正则表达式搜索。 object.Execute(string) 参数 object 必选项。总是一个 RegExp 对象的名称。 string
Clear 方法 清除 Err 对象的所有属性设置。 object.Clear object 应为 Err 对象的名称。 说明 在错误处理后,使用 Clear 显式地清除 Err 对象。此
CopyFile 方法 将一个或多个文件从某位置复制到另一位置。 object.CopyFile source, destination[, overwrite] 参数 object 必选
Copy 方法 将指定的文件或文件夹从某位置复制到另一位置。 object.Copy destination[, overwrite] 参数 object 必选项。应为 File 或 F
Close 方法 关闭打开的 TextStream 文件。 object.Close object 应为 TextStream 对象的名称。 说明 下面例子举例说明如何使用 Close 方
BuildPath 方法 向现有路径后添加名称。 object.BuildPath(path, name) 参数 object 必选项。应为 FileSystemObject 对象的名称
GetFolder 方法 返回与指定的路径中某文件夹相应的 Folder 对象。 object.GetFolder(folderspec) 参数 object 必选项。应为 FileSy
GetFileName 方法 返回指定路径(不是指定驱动器路径部分)的最后一个文件或文件夹。 object.GetFileName(pathspec) 参数 object 必选项。应为
GetFile 方法 返回与指定路径中某文件相应的 File 对象。 object.GetFile(filespec) 参数 object 必选项。应为 FileSystemObject
GetExtensionName 方法 返回字符串,该字符串包含路径最后一个组成部分的扩展名。 object.GetExtensionName(path) 参数 object 必选项。应
GetDriveName 方法 返回包含指定路径中驱动器名的字符串。 object.GetDriveName(path) 参数 object 必选项。应为 FileSystemObjec
GetDrive 方法 返回与指定的路径中驱动器相对应的 Drive 对象。 object.GetDrive drivespec 参数 object 必选项。应为 FileSystemO
GetBaseName 方法 返回字符串,其中包含文件的基本名 (不带扩展名), 或者提供的路径说明中的文件夹。 object.GetBaseName(path) 参数 object 必
GetAbsolutePathName 方法 从提供的指定路径中返回完整且含义明确的路径。 object.GetAbsolutePathName(pathspec) 参数 object
FolderExists 方法 如果指定的文件夹存在,则返回 True;否则返回 False。 object.FolderExists(folderspec) 参数 object 必选项
FileExists 方法 如果指定的文件存在返回 True;否则返回 False。 object.FileExists(filespec) 参数 object 必选项。应为 FileS
我是一名优秀的程序员,十分优秀!