switch (compressionFormat.toLowerCase()) { case COMPRESSION_FORMAT_LZMA: compressionIn = new LzmaInputStream(bufferedIn, new Decoder()); break; case COMPRESSION_FORMAT_XZ_LZMA2:
@Override public void code(final InputStream in, final OutputStream out) throws IOException { byte[] properties = new byte[5]; if (in.read(properties) != 5) { throw new IOException("LZMA file has no header!"); } if (!d.setDecoderProperties(properties)) { throw new IOException("Decoder properties cannot be set!"); } if (!d.code(in, out, len)) { throw new IOException("Decoding unsuccessful!"); } } }
public boolean setDecoderProperties(byte[] properties) { if (properties.length < 5) { return false; } int val = properties[0] & 0xFF; int lc = val % 9; int remainder = val / 9; int lp = remainder % 5; int pb = remainder / 5; int dictionarySize = 0; for (int i = 0; i < 4; i++) { dictionarySize += ((int) (properties[1 + i]) & 0xFF) << (i * 8); } return setLcLpPb(lc, lp, pb) && setDictionarySize(dictionarySize); } }
@Override public void code(final InputStream in, final OutputStream out) throws IOException { byte[] properties = new byte[5]; if (in.read(properties) != 5) { throw new IOException("LZMA file has no header!"); } if (!d.setDecoderProperties(properties)) { throw new IOException("Decoder properties cannot be set!"); } if (!d.code(in, out, len)) { throw new IOException("Decoding unsuccessful!"); } } }
public boolean setDecoderProperties(byte[] properties) { if (properties.length < 5) { return false; } int val = properties[0] & 0xFF; int lc = val % 9; int remainder = val / 9; int lp = remainder % 5; int pb = remainder / 5; int dictionarySize = 0; for (int i = 0; i < 4; i++) { dictionarySize += ((int) (properties[1 + i]) & 0xFF) << (i * 8); } return setLcLpPb(lc, lp, pb) && setDictionarySize(dictionarySize); } }
@Override public void code(final InputStream in, final OutputStream out) throws IOException { byte[] properties = new byte[5]; if (in.read(properties) != 5) { throw new IOException("LZMA file has no header!"); } if (!decoder.setDecoderProperties(properties)) { throw new IOException("Decoder properties cannot be set!"); } long outSize = 0; for (int i = 0; i < 8; i++) { int v = in.read(); if (v < 0) throw new IOException("Can't read stream size"); outSize |= ((long)v) << (8 * i); } if (!decoder.code(in, out, outSize)) { throw new IOException("Decoding unsuccessful!"); } } }
public CustomCoder(int packedLength) { d = new Decoder(); len = packedLength; }
@Override public void code(final InputStream in, final OutputStream out) throws IOException { byte[] properties = new byte[5]; if (in.read(properties) != 5) { throw new IOException("LZMA file has no header!"); } if (!decoder.setDecoderProperties(properties)) { throw new IOException("Decoder properties cannot be set!"); } long outSize = 0; for (int i = 0; i < 8; i++) { int v = in.read(); if (v < 0) throw new IOException("Can't read stream size"); outSize |= ((long)v) << (8 * i); } if (!decoder.code(in, out, outSize)) { throw new IOException("Decoding unsuccessful!"); } } }
public CustomWrapper(int packedLength) { d = new Decoder(); len = packedLength; }
try (ByteArrayOutputStream jarBytes = new ByteArrayOutputStream()) try (LzmaInputStream binpatchesDecompressed = new LzmaInputStream(new FileInputStream(getPatches()), new Decoder()); JarOutputStream jos = new JarOutputStream(jarBytes))
switch (compressionFormat.toLowerCase()) { case COMPRESSION_FORMAT_LZMA: compressionIn = new LzmaInputStream(bufferedIn, new Decoder()); break; case COMPRESSION_FORMAT_XZ_LZMA2: