@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!"); } } }
@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!"); } } }
@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!"); } } }
@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!"); } } }