org.tukaani.xz.XZFormatException Java Examples

The following examples show how to use org.tukaani.xz.XZFormatException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DecoderUtil.java    From packagedrone with Eclipse Public License 1.0 6 votes vote down vote up
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");
    }
}
 
Example #2
Source File: DecoderUtil.java    From LocalGSMLocationProvider with Apache License 2.0 6 votes vote down vote up
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");
    }
}