本文整理汇总了Java中org.tukaani.xz.CorruptedInputException类的典型用法代码示例。如果您正苦于以下问题:Java CorruptedInputException类的具体用法?Java CorruptedInputException怎么用?Java CorruptedInputException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CorruptedInputException类属于org.tukaani.xz包,在下文中一共展示了CorruptedInputException类的17个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: repeat
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public void repeat(int dist, int len) throws IOException {
if (dist < 0 || dist >= full)
throw new CorruptedInputException();
int left = Math.min(limit - pos, len);
pendingLen = len - left;
pendingDist = dist;
int back = pos - dist - 1;
if (dist >= pos)
back += buf.length;
do {
buf[pos++] = buf[back++];
if (back == buf.length)
back = 0;
} while (--left > 0);
if (full < pos)
full = pos;
}
开发者ID:dbrant,项目名称:zimdroid,代码行数:22,代码来源:LZDecoder.java
示例2: prepareInputBuffer
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public void prepareInputBuffer(DataInputStream in, int len)
throws IOException {
if (len < INIT_SIZE)
throw new CorruptedInputException();
if (in.readUnsignedByte() != 0x00)
throw new CorruptedInputException();
code = in.readInt();
range = 0xFFFFFFFF;
// Read the data to the end of the buffer. If the data is corrupt
// and the decoder, reading from buf, tries to read past the end of
// the data, ArrayIndexOutOfBoundsException will be thrown and
// the problem is detected immediately.
len -= INIT_SIZE;
pos = buf.length - len;
in.readFully(buf, pos, len);
}
开发者ID:dbrant,项目名称:zimdroid,代码行数:20,代码来源:RangeDecoderFromBuffer.java
示例3: decodeStreamHeader
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public static StreamFlags decodeStreamHeader(byte[] buf)
throws IOException {
for (int i = 0; i < XZ.HEADER_MAGIC.length; ++i)
if (buf[i] != XZ.HEADER_MAGIC[i])
throw new XZFormatException();
if (!isCRC32Valid(buf, XZ.HEADER_MAGIC.length, 2,
XZ.HEADER_MAGIC.length + 2))
throw new CorruptedInputException("XZ Stream Header is corrupt");
try {
return decodeStreamFlags(buf, XZ.HEADER_MAGIC.length);
} catch (UnsupportedOptionsException e) {
throw new UnsupportedOptionsException(
"Unsupported options in XZ Stream Header");
}
}
开发者ID:dbrant,项目名称:zimdroid,代码行数:18,代码来源:DecoderUtil.java
示例4: decodeVLI
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public static long decodeVLI(InputStream in) throws IOException {
int b = in.read();
if (b == -1)
throw new EOFException();
long num = b & 0x7F;
int i = 0;
while ((b & 0x80) != 0x00) {
if (++i >= VLI_SIZE_MAX)
throw new CorruptedInputException();
b = in.read();
if (b == -1)
throw new EOFException();
if (b == 0x00)
throw new CorruptedInputException();
num |= (long)(b & 0x7F) << (i * 7);
}
return num;
}
开发者ID:dbrant,项目名称:zimdroid,代码行数:25,代码来源:DecoderUtil.java
示例5: repeat
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public void repeat(int dist, int len) throws IOException {
if (dist < 0 || dist >= full)
throw new CorruptedInputException();
int left = Math.min(limit - pos, len);
pendingLen = len - left;
pendingDist = dist;
int back = pos - dist - 1;
if (dist >= pos)
back += buf.length;
do {
buf[pos++] = buf[back++];
if (back == buf.length)
back = 0;
} while (--left > 0);
if (full < pos)
full = pos;
}
开发者ID:anadon,项目名称:JLS,代码行数:22,代码来源:LZDecoder.java
示例6: decodeStreamHeader
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public static StreamFlags decodeStreamHeader(byte[] buf) throws IOException {
for (int i = 0; i < XZ.HEADER_MAGIC.length; ++i)
if (buf[i] != XZ.HEADER_MAGIC[i])
throw new XZFormatException();
if (!isCRC32Valid(buf, XZ.HEADER_MAGIC.length, 2,
XZ.HEADER_MAGIC.length + 2))
throw new CorruptedInputException("XZ Stream Header is corrupt");
try {
return decodeStreamFlags(buf, XZ.HEADER_MAGIC.length);
} catch (UnsupportedOptionsException e) {
throw new UnsupportedOptionsException(
"Unsupported options in XZ Stream Header");
}
}
开发者ID:anadon,项目名称:JLS,代码行数:17,代码来源:DecoderUtil.java
示例7: decodeStreamFooter
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public static StreamFlags decodeStreamFooter(byte[] buf) throws IOException {
if (buf[10] != XZ.FOOTER_MAGIC[0] || buf[11] != XZ.FOOTER_MAGIC[1]) {
// NOTE: The exception could be XZFormatException too.
// It depends on the situation which one is better.
throw new CorruptedInputException("XZ Stream Footer is corrupt");
}
if (!isCRC32Valid(buf, 4, 6, 0))
throw new CorruptedInputException("XZ Stream Footer is corrupt");
StreamFlags streamFlags;
try {
streamFlags = decodeStreamFlags(buf, 8);
} catch (UnsupportedOptionsException e) {
throw new UnsupportedOptionsException(
"Unsupported options in XZ Stream Footer");
}
streamFlags.backwardSize = 0;
for (int i = 0; i < 4; ++i)
streamFlags.backwardSize |= (buf[i + 4] & 0xFF) << (i * 8);
streamFlags.backwardSize = (streamFlags.backwardSize + 1) * 4;
return streamFlags;
}
开发者ID:anadon,项目名称:JLS,代码行数:27,代码来源:DecoderUtil.java
示例8: decodeVLI
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public static long decodeVLI(InputStream in) throws IOException {
int b = in.read();
if (b == -1)
throw new EOFException();
long num = b & 0x7F;
int i = 0;
while ((b & 0x80) != 0x00) {
if (++i >= VLI_SIZE_MAX)
throw new CorruptedInputException();
b = in.read();
if (b == -1)
throw new EOFException();
if (b == 0x00)
throw new CorruptedInputException();
num |= (long) (b & 0x7F) << (i * 7);
}
return num;
}
开发者ID:anadon,项目名称:JLS,代码行数:25,代码来源:DecoderUtil.java
示例9: IndexHash
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public IndexHash() {
super(new CorruptedInputException());
try {
hash = new org.tukaani.xz.check.SHA256();
} catch (java.security.NoSuchAlgorithmException e) {
hash = new org.tukaani.xz.check.CRC32();
}
}
开发者ID:dbrant,项目名称:zimdroid,代码行数:10,代码来源:IndexHash.java
示例10: normalize
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public void normalize() throws IOException {
if ((range & TOP_MASK) == 0) {
try {
// If the input is corrupt, this might throw
// ArrayIndexOutOfBoundsException.
code = (code << SHIFT_BITS) | (buf[pos++] & 0xFF);
range <<= SHIFT_BITS;
} catch (ArrayIndexOutOfBoundsException e) {
throw new CorruptedInputException();
}
}
}
开发者ID:dbrant,项目名称:zimdroid,代码行数:13,代码来源:RangeDecoderFromBuffer.java
示例11: RangeDecoderFromStream
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public RangeDecoderFromStream(InputStream in) throws IOException {
inData = new DataInputStream(in);
if (inData.readUnsignedByte() != 0x00)
throw new CorruptedInputException();
code = inData.readInt();
range = 0xFFFFFFFF;
}
开发者ID:dbrant,项目名称:zimdroid,代码行数:10,代码来源:RangeDecoderFromStream.java
示例12: decodeStreamFooter
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public static StreamFlags decodeStreamFooter(byte[] buf)
throws IOException {
if (buf[10] != XZ.FOOTER_MAGIC[0] || buf[11] != XZ.FOOTER_MAGIC[1]) {
// NOTE: The exception could be XZFormatException too.
// It depends on the situation which one is better.
throw new CorruptedInputException("XZ Stream Footer is corrupt");
}
if (!isCRC32Valid(buf, 4, 6, 0))
throw new CorruptedInputException("XZ Stream Footer is corrupt");
StreamFlags streamFlags;
try {
streamFlags = decodeStreamFlags(buf, 8);
} catch (UnsupportedOptionsException e) {
throw new UnsupportedOptionsException(
"Unsupported options in XZ Stream Footer");
}
streamFlags.backwardSize = 0;
for (int i = 0; i < 4; ++i)
streamFlags.backwardSize |= (buf[i + 4] & 0xFF) << (i * 8);
streamFlags.backwardSize = (streamFlags.backwardSize + 1) * 4;
return streamFlags;
}
开发者ID:dbrant,项目名称:zimdroid,代码行数:28,代码来源:DecoderUtil.java
示例13: prepareInputBuffer
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public void prepareInputBuffer(DataInputStream in, int len)
throws IOException {
if (len < INIT_SIZE)
throw new CorruptedInputException();
if (in.readUnsignedByte() != 0x00)
throw new CorruptedInputException();
code = in.readInt();
range = 0xFFFFFFFF;
pos = 0;
end = len - INIT_SIZE;
in.readFully(buf, 0, end);
}
开发者ID:eclipse,项目名称:packagedrone,代码行数:16,代码来源:RangeDecoderFromBuffer.java
示例14: IndexHash
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public IndexHash() {
super(new CorruptedInputException());
try {
hash = new org.tukaani.xz.check.SHA256();
} catch (java.security.NoSuchAlgorithmException e) {
hash = new org.tukaani.xz.check.CRC32();
}
}
开发者ID:anadon,项目名称:JLS,代码行数:10,代码来源:IndexHash.java
示例15: prepareInputBuffer
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public void prepareInputBuffer(DataInputStream in, int len)
throws IOException {
if (len < INIT_SIZE)
throw new CorruptedInputException();
if (in.readUnsignedByte() != 0x00)
throw new CorruptedInputException();
code = in.readInt();
range = 0xFFFFFFFF;
pos = 0;
end = len - INIT_SIZE;
in.readFully(buf, 0, end);
}
开发者ID:anadon,项目名称:JLS,代码行数:16,代码来源:RangeDecoderFromBuffer.java
示例16: normalize
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public void normalize() throws IOException {
if ((range & TOP_MASK) == 0) {
try {
// If the input is corrupt, this might throw
// ArrayIndexOutOfBoundsException.
code = (code << SHIFT_BITS) | (buf[pos++] & 0xFF);
range <<= SHIFT_BITS;
} catch (ArrayIndexOutOfBoundsException e) {
throw new CorruptedInputException();
}
}
}
开发者ID:anadon,项目名称:JLS,代码行数:13,代码来源:RangeDecoderFromBuffer.java
示例17: RangeDecoderFromStream
import org.tukaani.xz.CorruptedInputException; //导入依赖的package包/类
public RangeDecoderFromStream(InputStream in) throws IOException {
inData = new DataInputStream(in);
if (inData.readUnsignedByte() != 0x00)
throw new CorruptedInputException();
code = inData.readInt();
range = 0xFFFFFFFF;
}
开发者ID:anadon,项目名称:JLS,代码行数:10,代码来源:RangeDecoderFromStream.java
注:本文中的org.tukaani.xz.CorruptedInputException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论