Index: unk/src/org/tukaani/xz/ARMOptions.java
===================================================================
--- /trunk/src/org/tukaani/xz/ARMOptions.java	(revision 13352)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * ARMOptions
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.InputStream;
-import org.tukaani.xz.simple.ARM;
-
-/**
- * BCJ filter for little endian ARM instructions.
- */
-public class ARMOptions extends BCJOptions {
-    private static final int ALIGNMENT = 4;
-
-    public ARMOptions() {
-        super(ALIGNMENT);
-    }
-
-    public FinishableOutputStream getOutputStream(FinishableOutputStream out,
-                                                  ArrayCache arrayCache) {
-        return new SimpleOutputStream(out, new ARM(true, startOffset));
-    }
-
-    public InputStream getInputStream(InputStream in, ArrayCache arrayCache) {
-        return new SimpleInputStream(in, new ARM(false, startOffset));
-    }
-
-    FilterEncoder getFilterEncoder() {
-        return new BCJEncoder(this, BCJCoder.ARM_FILTER_ID);
-    }
-}
Index: unk/src/org/tukaani/xz/ARMThumbOptions.java
===================================================================
--- /trunk/src/org/tukaani/xz/ARMThumbOptions.java	(revision 13352)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * ARMThumbOptions
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.InputStream;
-import org.tukaani.xz.simple.ARMThumb;
-
-/**
- * BCJ filter for little endian ARM-Thumb instructions.
- */
-public class ARMThumbOptions extends BCJOptions {
-    private static final int ALIGNMENT = 2;
-
-    public ARMThumbOptions() {
-        super(ALIGNMENT);
-    }
-
-    public FinishableOutputStream getOutputStream(FinishableOutputStream out,
-                                                  ArrayCache arrayCache) {
-        return new SimpleOutputStream(out, new ARMThumb(true, startOffset));
-    }
-
-    public InputStream getInputStream(InputStream in, ArrayCache arrayCache) {
-        return new SimpleInputStream(in, new ARMThumb(false, startOffset));
-    }
-
-    FilterEncoder getFilterEncoder() {
-        return new BCJEncoder(this, BCJCoder.ARMTHUMB_FILTER_ID);
-    }
-}
Index: unk/src/org/tukaani/xz/BCJEncoder.java
===================================================================
--- /trunk/src/org/tukaani/xz/BCJEncoder.java	(revision 13352)
+++ 	(revision )
@@ -1,49 +1,0 @@
-/*
- * BCJEncoder
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-class BCJEncoder extends BCJCoder implements FilterEncoder {
-    private final BCJOptions options;
-    private final long filterID;
-    private final byte[] props;
-
-    BCJEncoder(BCJOptions options, long filterID) {
-        assert isBCJFilterID(filterID);
-        int startOffset = options.getStartOffset();
-
-        if (startOffset == 0) {
-            props = new byte[0];
-        } else {
-            props = new byte[4];
-            for (int i = 0; i < 4; ++i)
-                props[i] = (byte)(startOffset >>> (i * 8));
-        }
-
-        this.filterID = filterID;
-        this.options = (BCJOptions)options.clone();
-    }
-
-    public long getFilterID() {
-        return filterID;
-    }
-
-    public byte[] getFilterProps() {
-        return props;
-    }
-
-    public boolean supportsFlushing() {
-        return false;
-    }
-
-    public FinishableOutputStream getOutputStream(FinishableOutputStream out,
-                                                  ArrayCache arrayCache) {
-        return options.getOutputStream(out, arrayCache);
-    }
-}
Index: unk/src/org/tukaani/xz/BCJOptions.java
===================================================================
--- /trunk/src/org/tukaani/xz/BCJOptions.java	(revision 13352)
+++ 	(revision )
@@ -1,57 +1,0 @@
-/*
- * BCJOptions
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-abstract class BCJOptions extends FilterOptions {
-    private final int alignment;
-    int startOffset = 0;
-
-    BCJOptions(int alignment) {
-        this.alignment = alignment;
-    }
-
-    /**
-     * Sets the start offset for the address conversions.
-     * Normally this is useless so you shouldn't use this function.
-     * The default value is <code>0</code>.
-     */
-    public void setStartOffset(int startOffset)
-            throws UnsupportedOptionsException {
-        if ((startOffset & (alignment - 1)) != 0)
-            throw new UnsupportedOptionsException(
-                    "Start offset must be a multiple of " + alignment);
-
-        this.startOffset = startOffset;
-    }
-
-    /**
-     * Gets the start offset.
-     */
-    public int getStartOffset() {
-        return startOffset;
-    }
-
-    public int getEncoderMemoryUsage() {
-        return SimpleOutputStream.getMemoryUsage();
-    }
-
-    public int getDecoderMemoryUsage() {
-        return SimpleInputStream.getMemoryUsage();
-    }
-
-    public Object clone() {
-        try {
-            return super.clone();
-        } catch (CloneNotSupportedException e) {
-            assert false;
-            throw new RuntimeException();
-        }
-    }
-}
Index: unk/src/org/tukaani/xz/FinishableWrapperOutputStream.java
===================================================================
--- /trunk/src/org/tukaani/xz/FinishableWrapperOutputStream.java	(revision 13352)
+++ 	(revision )
@@ -1,70 +1,0 @@
-/*
- * FinishableWrapperOutputStream
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.OutputStream;
-import java.io.IOException;
-
-/**
- * Wraps an output stream to a finishable output stream for use with
- * raw encoders. This is not needed for XZ compression and thus most
- * people will never need this.
- */
-public class FinishableWrapperOutputStream extends FinishableOutputStream {
-    /**
-     * The {@link java.io.OutputStream OutputStream} that has been
-     * wrapped into a FinishableWrapperOutputStream.
-     */
-    protected OutputStream out;
-
-    /**
-     * Creates a new output stream which support finishing.
-     * The <code>finish()</code> method will do nothing.
-     */
-    public FinishableWrapperOutputStream(OutputStream out) {
-        this.out = out;
-    }
-
-    /**
-     * Calls {@link java.io.OutputStream#write(int) out.write(b)}.
-     */
-    public void write(int b) throws IOException {
-        out.write(b);
-    }
-
-    /**
-     * Calls {@link java.io.OutputStream#write(byte[]) out.write(buf)}.
-     */
-    public void write(byte[] buf) throws IOException {
-        out.write(buf);
-    }
-
-    /**
-     * Calls {@link java.io.OutputStream#write(byte[],int,int)
-                    out.write(buf, off, len)}.
-     */
-    public void write(byte[] buf, int off, int len) throws IOException {
-        out.write(buf, off, len);
-    }
-
-    /**
-     * Calls {@link java.io.OutputStream#flush() out.flush()}.
-     */
-    public void flush() throws IOException {
-        out.flush();
-    }
-
-    /**
-     * Calls {@link java.io.OutputStream#close() out.close()}.
-     */
-    public void close() throws IOException {
-        out.close();
-    }
-}
Index: unk/src/org/tukaani/xz/IA64Options.java
===================================================================
--- /trunk/src/org/tukaani/xz/IA64Options.java	(revision 13352)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * IA64Options
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.InputStream;
-import org.tukaani.xz.simple.IA64;
-
-/**
- * BCJ filter for Itanium (IA-64) instructions.
- */
-public class IA64Options extends BCJOptions {
-    private static final int ALIGNMENT = 16;
-
-    public IA64Options() {
-        super(ALIGNMENT);
-    }
-
-    public FinishableOutputStream getOutputStream(FinishableOutputStream out,
-                                                  ArrayCache arrayCache) {
-        return new SimpleOutputStream(out, new IA64(true, startOffset));
-    }
-
-    public InputStream getInputStream(InputStream in, ArrayCache arrayCache) {
-        return new SimpleInputStream(in, new IA64(false, startOffset));
-    }
-
-    FilterEncoder getFilterEncoder() {
-        return new BCJEncoder(this, BCJCoder.IA64_FILTER_ID);
-    }
-}
Index: unk/src/org/tukaani/xz/LZMAInputStream.java
===================================================================
--- /trunk/src/org/tukaani/xz/LZMAInputStream.java	(revision 13352)
+++ 	(revision )
@@ -1,763 +1,0 @@
-/*
- * LZMAInputStream
- *
- * Authors: Lasse Collin <lasse.collin@tukaani.org>
- *          Igor Pavlov <http://7-zip.org/>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.InputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import org.tukaani.xz.lz.LZDecoder;
-import org.tukaani.xz.rangecoder.RangeDecoderFromStream;
-import org.tukaani.xz.lzma.LZMADecoder;
-
-/**
- * Decompresses legacy .lzma files and raw LZMA streams (no .lzma header).
- * <p>
- * <b>IMPORTANT:</b> In contrast to other classes in this package, this class
- * reads data from its input stream one byte at a time. If the input stream
- * is for example {@link java.io.FileInputStream}, wrapping it into
- * {@link java.io.BufferedInputStream} tends to improve performance a lot.
- * This is not automatically done by this class because there may be use
- * cases where it is desired that this class won't read any bytes past
- * the end of the LZMA stream.
- * <p>
- * Even when using <code>BufferedInputStream</code>, the performance tends
- * to be worse (maybe 10-20&nbsp;% slower) than with {@link LZMA2InputStream}
- * or {@link XZInputStream} (when the .xz file contains LZMA2-compressed data).
- *
- * @since 1.4
- */
-public class LZMAInputStream extends InputStream {
-    /**
-     * Largest dictionary size supported by this implementation.
-     * <p>
-     * LZMA allows dictionaries up to one byte less than 4 GiB. This
-     * implementation supports only 16 bytes less than 2 GiB. This
-     * limitation is due to Java using signed 32-bit integers for array
-     * indexing. The limitation shouldn't matter much in practice since so
-     * huge dictionaries are not normally used.
-     */
-    public static final int DICT_SIZE_MAX = Integer.MAX_VALUE & ~15;
-
-    private InputStream in;
-    private ArrayCache arrayCache;
-    private LZDecoder lz;
-    private RangeDecoderFromStream rc;
-    private LZMADecoder lzma;
-
-    private boolean endReached = false;
-
-    private final byte[] tempBuf = new byte[1];
-
-    /**
-     * Number of uncompressed bytes left to be decompressed, or -1 if
-     * the end marker is used.
-     */
-    private long remainingSize;
-
-    private IOException exception = null;
-
-    /**
-     * Gets approximate decompressor memory requirements as kibibytes for
-     * the given dictionary size and LZMA properties byte (lc, lp, and pb).
-     *
-     * @param       dictSize    LZMA dictionary size as bytes, should be
-     *                          in the range [<code>0</code>,
-     *                          <code>DICT_SIZE_MAX</code>]
-     *
-     * @param       propsByte   LZMA properties byte that encodes the values
-     *                          of lc, lp, and pb
-     *
-     * @return      approximate memory requirements as kibibytes (KiB)
-     *
-     * @throws      UnsupportedOptionsException
-     *                          if <code>dictSize</code> is outside
-     *                          the range [<code>0</code>,
-     *                          <code>DICT_SIZE_MAX</code>]
-     *
-     * @throws      CorruptedInputException
-     *                          if <code>propsByte</code> is invalid
-     */
-    public static int getMemoryUsage(int dictSize, byte propsByte)
-            throws UnsupportedOptionsException, CorruptedInputException {
-        if (dictSize < 0 || dictSize > DICT_SIZE_MAX)
-            throw new UnsupportedOptionsException(
-                    "LZMA dictionary is too big for this implementation");
-
-        int props = propsByte & 0xFF;
-        if (props > (4 * 5 + 4) * 9 + 8)
-            throw new CorruptedInputException("Invalid LZMA properties byte");
-
-        props %= 9 * 5;
-        int lp = props / 9;
-        int lc = props - lp * 9;
-
-        return getMemoryUsage(dictSize, lc, lp);
-    }
-
-    /**
-     * Gets approximate decompressor memory requirements as kibibytes for
-     * the given dictionary size, lc, and lp. Note that pb isn't needed.
-     *
-     * @param       dictSize    LZMA dictionary size as bytes, must be
-     *                          in the range [<code>0</code>,
-     *                          <code>DICT_SIZE_MAX</code>]
-     *
-     * @param       lc          number of literal context bits, must be
-     *                          in the range [0, 8]
-     *
-     * @param       lp          number of literal position bits, must be
-     *                          in the range [0, 4]
-     *
-     * @return      approximate memory requirements as kibibytes (KiB)
-     */
-    public static int getMemoryUsage(int dictSize, int lc, int lp) {
-        if (lc < 0 || lc > 8 || lp < 0 || lp > 4)
-            throw new IllegalArgumentException("Invalid lc or lp");
-
-        // Probability variables have the type "short". There are
-        // 0x300 (768) probability variables in each literal subcoder.
-        // The number of literal subcoders is 2^(lc + lp).
-        //
-        // Roughly 10 KiB for the base state + LZ decoder's dictionary buffer
-        // + sizeof(short) * number probability variables per literal subcoder
-        //   * number of literal subcoders
-        return 10 + getDictSize(dictSize) / 1024
-               + ((2 * 0x300) << (lc + lp)) / 1024;
-    }
-
-    private static int getDictSize(int dictSize) {
-        if (dictSize < 0 || dictSize > DICT_SIZE_MAX)
-            throw new IllegalArgumentException(
-                    "LZMA dictionary is too big for this implementation");
-
-        // For performance reasons, use a 4 KiB dictionary if something
-        // smaller was requested. It's a rare situation and the performance
-        // difference isn't huge, and it starts to matter mostly when the
-        // dictionary is just a few bytes. But we need to handle the special
-        // case of dictSize == 0 anyway, which is an allowed value but in
-        // practice means one-byte dictionary.
-        //
-        // Note that using a dictionary bigger than specified in the headers
-        // can hide errors if there is a reference to data beyond the original
-        // dictionary size but is still within 4 KiB.
-        if (dictSize < 4096)
-            dictSize = 4096;
-
-        // Round dictionary size upward to a multiple of 16. This way LZMA
-        // can use LZDecoder.getPos() for calculating LZMA's posMask.
-        return (dictSize + 15) & ~15;
-    }
-
-    /**
-     * Creates a new .lzma file format decompressor without
-     * a memory usage limit.
-     *
-     * @param       in          input stream from which .lzma data is read;
-     *                          it might be a good idea to wrap it in
-     *                          <code>BufferedInputStream</code>, see the
-     *                          note at the top of this page
-     *
-     * @throws      CorruptedInputException
-     *                          file is corrupt or perhaps not in
-     *                          the .lzma format at all
-     *
-     * @throws      UnsupportedOptionsException
-     *                          dictionary size or uncompressed size is too
-     *                          big for this implementation
-     *
-     * @throws      EOFException
-     *                          file is truncated or perhaps not in
-     *                          the .lzma format at all
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public LZMAInputStream(InputStream in) throws IOException {
-        this(in, -1);
-    }
-
-    /**
-     * Creates a new .lzma file format decompressor without
-     * a memory usage limit.
-     * <p>
-     * This is identical to <code>LZMAInputStream(InputStream)</code>
-     * except that this also takes the <code>arrayCache</code> argument.
-     *
-     * @param       in          input stream from which .lzma data is read;
-     *                          it might be a good idea to wrap it in
-     *                          <code>BufferedInputStream</code>, see the
-     *                          note at the top of this page
-     *
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      CorruptedInputException
-     *                          file is corrupt or perhaps not in
-     *                          the .lzma format at all
-     *
-     * @throws      UnsupportedOptionsException
-     *                          dictionary size or uncompressed size is too
-     *                          big for this implementation
-     *
-     * @throws      EOFException
-     *                          file is truncated or perhaps not in
-     *                          the .lzma format at all
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     *
-     * @since 1.7
-     */
-    public LZMAInputStream(InputStream in, ArrayCache arrayCache)
-            throws IOException {
-        this(in, -1, arrayCache);
-    }
-
-    /**
-     * Creates a new .lzma file format decompressor with an optional
-     * memory usage limit.
-     *
-     * @param       in          input stream from which .lzma data is read;
-     *                          it might be a good idea to wrap it in
-     *                          <code>BufferedInputStream</code>, see the
-     *                          note at the top of this page
-     *
-     * @param       memoryLimit memory usage limit in kibibytes (KiB)
-     *                          or <code>-1</code> to impose no
-     *                          memory usage limit
-     *
-     * @throws      CorruptedInputException
-     *                          file is corrupt or perhaps not in
-     *                          the .lzma format at all
-     *
-     * @throws      UnsupportedOptionsException
-     *                          dictionary size or uncompressed size is too
-     *                          big for this implementation
-     *
-     * @throws      MemoryLimitException
-     *                          memory usage limit was exceeded
-     *
-     * @throws      EOFException
-     *                          file is truncated or perhaps not in
-     *                          the .lzma format at all
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public LZMAInputStream(InputStream in, int memoryLimit)
-            throws IOException {
-        this(in, memoryLimit, ArrayCache.getDefaultCache());
-    }
-
-    /**
-     * Creates a new .lzma file format decompressor with an optional
-     * memory usage limit.
-     * <p>
-     * This is identical to <code>LZMAInputStream(InputStream, int)</code>
-     * except that this also takes the <code>arrayCache</code> argument.
-     *
-     * @param       in          input stream from which .lzma data is read;
-     *                          it might be a good idea to wrap it in
-     *                          <code>BufferedInputStream</code>, see the
-     *                          note at the top of this page
-     *
-     * @param       memoryLimit memory usage limit in kibibytes (KiB)
-     *                          or <code>-1</code> to impose no
-     *                          memory usage limit
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      CorruptedInputException
-     *                          file is corrupt or perhaps not in
-     *                          the .lzma format at all
-     *
-     * @throws      UnsupportedOptionsException
-     *                          dictionary size or uncompressed size is too
-     *                          big for this implementation
-     *
-     * @throws      MemoryLimitException
-     *                          memory usage limit was exceeded
-     *
-     * @throws      EOFException
-     *                          file is truncated or perhaps not in
-     *                          the .lzma format at all
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     *
-     * @since 1.7
-     */
-    public LZMAInputStream(InputStream in, int memoryLimit,
-                           ArrayCache arrayCache) throws IOException {
-        DataInputStream inData = new DataInputStream(in);
-
-        // Properties byte (lc, lp, and pb)
-        byte propsByte = inData.readByte();
-
-        // Dictionary size is an unsigned 32-bit little endian integer.
-        int dictSize = 0;
-        for (int i = 0; i < 4; ++i)
-            dictSize |= inData.readUnsignedByte() << (8 * i);
-
-        // Uncompressed size is an unsigned 64-bit little endian integer.
-        // The maximum 64-bit value is a special case (becomes -1 here)
-        // which indicates that the end marker is used instead of knowing
-        // the uncompressed size beforehand.
-        long uncompSize = 0;
-        for (int i = 0; i < 8; ++i)
-            uncompSize |= (long)inData.readUnsignedByte() << (8 * i);
-
-        // Check the memory usage limit.
-        int memoryNeeded = getMemoryUsage(dictSize, propsByte);
-        if (memoryLimit != -1 && memoryNeeded > memoryLimit)
-            throw new MemoryLimitException(memoryNeeded, memoryLimit);
-
-        initialize(in, uncompSize, propsByte, dictSize, null, arrayCache);
-    }
-
-    /**
-     * Creates a new input stream that decompresses raw LZMA data (no .lzma
-     * header) from <code>in</code>.
-     * <p>
-     * The caller needs to know if the "end of payload marker (EOPM)" alias
-     * "end of stream marker (EOS marker)" alias "end marker" present.
-     * If the end marker isn't used, the caller must know the exact
-     * uncompressed size of the stream.
-     * <p>
-     * The caller also needs to provide the LZMA properties byte that encodes
-     * the number of literal context bits (lc), literal position bits (lp),
-     * and position bits (pb).
-     * <p>
-     * The dictionary size used when compressing is also needed. Specifying
-     * a too small dictionary size will prevent decompressing the stream.
-     * Specifying a too big dictionary is waste of memory but decompression
-     * will work.
-     * <p>
-     * There is no need to specify a dictionary bigger than
-     * the uncompressed size of the data even if a bigger dictionary
-     * was used when compressing. If you know the uncompressed size
-     * of the data, this might allow saving some memory.
-     *
-     * @param       in          input stream from which compressed
-     *                          data is read
-     *
-     * @param       uncompSize  uncompressed size of the LZMA stream or -1
-     *                          if the end marker is used in the LZMA stream
-     *
-     * @param       propsByte   LZMA properties byte that has the encoded
-     *                          values for literal context bits (lc), literal
-     *                          position bits (lp), and position bits (pb)
-     *
-     * @param       dictSize    dictionary size as bytes, must be in the range
-     *                          [<code>0</code>, <code>DICT_SIZE_MAX</code>]
-     *
-     * @throws      CorruptedInputException
-     *                          if <code>propsByte</code> is invalid or
-     *                          the first input byte is not 0x00
-     *
-     * @throws      UnsupportedOptionsException
-     *                          dictionary size or uncompressed size is too
-     *                          big for this implementation
-     *
-     *
-     */
-    public LZMAInputStream(InputStream in, long uncompSize, byte propsByte,
-                           int dictSize) throws IOException {
-        initialize(in, uncompSize, propsByte, dictSize, null,
-                   ArrayCache.getDefaultCache());
-    }
-
-    /**
-     * Creates a new input stream that decompresses raw LZMA data (no .lzma
-     * header) from <code>in</code> optionally with a preset dictionary.
-     *
-     * @param       in          input stream from which LZMA-compressed
-     *                          data is read
-     *
-     * @param       uncompSize  uncompressed size of the LZMA stream or -1
-     *                          if the end marker is used in the LZMA stream
-     *
-     * @param       propsByte   LZMA properties byte that has the encoded
-     *                          values for literal context bits (lc), literal
-     *                          position bits (lp), and position bits (pb)
-     *
-     * @param       dictSize    dictionary size as bytes, must be in the range
-     *                          [<code>0</code>, <code>DICT_SIZE_MAX</code>]
-     *
-     * @param       presetDict  preset dictionary or <code>null</code>
-     *                          to use no preset dictionary
-     *
-     * @throws      CorruptedInputException
-     *                          if <code>propsByte</code> is invalid or
-     *                          the first input byte is not 0x00
-     *
-     * @throws      UnsupportedOptionsException
-     *                          dictionary size or uncompressed size is too
-     *                          big for this implementation
-     *
-     * @throws      EOFException file is truncated or corrupt
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public LZMAInputStream(InputStream in, long uncompSize, byte propsByte,
-                           int dictSize, byte[] presetDict)
-            throws IOException {
-        initialize(in, uncompSize, propsByte, dictSize, presetDict,
-                   ArrayCache.getDefaultCache());
-    }
-
-    /**
-     * Creates a new input stream that decompresses raw LZMA data (no .lzma
-     * header) from <code>in</code> optionally with a preset dictionary.
-     * <p>
-     * This is identical to <code>LZMAInputStream(InputStream, long, byte, int,
-     * byte[])</code> except that this also takes the <code>arrayCache</code>
-     * argument.
-     *
-     * @param       in          input stream from which LZMA-compressed
-     *                          data is read
-     *
-     * @param       uncompSize  uncompressed size of the LZMA stream or -1
-     *                          if the end marker is used in the LZMA stream
-     *
-     * @param       propsByte   LZMA properties byte that has the encoded
-     *                          values for literal context bits (lc), literal
-     *                          position bits (lp), and position bits (pb)
-     *
-     * @param       dictSize    dictionary size as bytes, must be in the range
-     *                          [<code>0</code>, <code>DICT_SIZE_MAX</code>]
-     *
-     * @param       presetDict  preset dictionary or <code>null</code>
-     *                          to use no preset dictionary
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      CorruptedInputException
-     *                          if <code>propsByte</code> is invalid or
-     *                          the first input byte is not 0x00
-     *
-     * @throws      UnsupportedOptionsException
-     *                          dictionary size or uncompressed size is too
-     *                          big for this implementation
-     *
-     * @throws      EOFException file is truncated or corrupt
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     *
-     * @since 1.7
-     */
-    public LZMAInputStream(InputStream in, long uncompSize, byte propsByte,
-                           int dictSize, byte[] presetDict,
-                           ArrayCache arrayCache)
-            throws IOException {
-        initialize(in, uncompSize, propsByte, dictSize, presetDict,
-                   arrayCache);
-    }
-
-    /**
-     * Creates a new input stream that decompresses raw LZMA data (no .lzma
-     * header) from <code>in</code> optionally with a preset dictionary.
-     *
-     * @param       in          input stream from which LZMA-compressed
-     *                          data is read
-     *
-     * @param       uncompSize  uncompressed size of the LZMA stream or -1
-     *                          if the end marker is used in the LZMA stream
-     *
-     * @param       lc          number of literal context bits, must be
-     *                          in the range [0, 8]
-     *
-     * @param       lp          number of literal position bits, must be
-     *                          in the range [0, 4]
-     *
-     * @param       pb          number position bits, must be
-     *                          in the range [0, 4]
-     *
-     * @param       dictSize    dictionary size as bytes, must be in the range
-     *                          [<code>0</code>, <code>DICT_SIZE_MAX</code>]
-     *
-     * @param       presetDict  preset dictionary or <code>null</code>
-     *                          to use no preset dictionary
-     *
-     * @throws      CorruptedInputException
-     *                          if the first input byte is not 0x00
-     *
-     * @throws      EOFException file is truncated or corrupt
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public LZMAInputStream(InputStream in, long uncompSize,
-                           int lc, int lp, int pb,
-                           int dictSize, byte[] presetDict)
-            throws IOException {
-        initialize(in, uncompSize, lc, lp, pb, dictSize, presetDict,
-                   ArrayCache.getDefaultCache());
-    }
-
-    /**
-     * Creates a new input stream that decompresses raw LZMA data (no .lzma
-     * header) from <code>in</code> optionally with a preset dictionary.
-     * <p>
-     * This is identical to <code>LZMAInputStream(InputStream, long, int, int,
-     * int, int, byte[])</code> except that this also takes the
-     * <code>arrayCache</code> argument.
-     *
-     * @param       in          input stream from which LZMA-compressed
-     *                          data is read
-     *
-     * @param       uncompSize  uncompressed size of the LZMA stream or -1
-     *                          if the end marker is used in the LZMA stream
-     *
-     * @param       lc          number of literal context bits, must be
-     *                          in the range [0, 8]
-     *
-     * @param       lp          number of literal position bits, must be
-     *                          in the range [0, 4]
-     *
-     * @param       pb          number position bits, must be
-     *                          in the range [0, 4]
-     *
-     * @param       dictSize    dictionary size as bytes, must be in the range
-     *                          [<code>0</code>, <code>DICT_SIZE_MAX</code>]
-     *
-     * @param       presetDict  preset dictionary or <code>null</code>
-     *                          to use no preset dictionary
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      CorruptedInputException
-     *                          if the first input byte is not 0x00
-     *
-     * @throws      EOFException file is truncated or corrupt
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     *
-     * @since 1.7
-     */
-    public LZMAInputStream(InputStream in, long uncompSize,
-                           int lc, int lp, int pb,
-                           int dictSize, byte[] presetDict,
-                           ArrayCache arrayCache)
-            throws IOException {
-        initialize(in, uncompSize, lc, lp, pb, dictSize, presetDict,
-                   arrayCache);
-    }
-
-    private void initialize(InputStream in, long uncompSize, byte propsByte,
-                            int dictSize, byte[] presetDict,
-                            ArrayCache arrayCache)
-            throws IOException {
-        // Validate the uncompressed size since the other "initialize" throws
-        // IllegalArgumentException if uncompSize < -1.
-        if (uncompSize < -1)
-            throw new UnsupportedOptionsException(
-                    "Uncompressed size is too big");
-
-        // Decode the properties byte. In contrast to LZMA2, there is no
-        // limit of lc + lp <= 4.
-        int props = propsByte & 0xFF;
-        if (props > (4 * 5 + 4) * 9 + 8)
-            throw new CorruptedInputException("Invalid LZMA properties byte");
-
-        int pb = props / (9 * 5);
-        props -= pb * 9 * 5;
-        int lp = props / 9;
-        int lc = props - lp * 9;
-
-        // Validate the dictionary size since the other "initialize" throws
-        // IllegalArgumentException if dictSize is not supported.
-        if (dictSize < 0 || dictSize > DICT_SIZE_MAX)
-            throw new UnsupportedOptionsException(
-                    "LZMA dictionary is too big for this implementation");
-
-        initialize(in, uncompSize, lc, lp, pb, dictSize, presetDict,
-                   arrayCache);
-    }
-
-    private void initialize(InputStream in, long uncompSize,
-                            int lc, int lp, int pb,
-                            int dictSize, byte[] presetDict,
-                            ArrayCache arrayCache)
-            throws IOException {
-        // getDictSize validates dictSize and gives a message in
-        // the exception too, so skip validating dictSize here.
-        if (uncompSize < -1 || lc < 0 || lc > 8 || lp < 0 || lp > 4
-                || pb < 0 || pb > 4)
-            throw new IllegalArgumentException();
-
-        this.in = in;
-        this.arrayCache = arrayCache;
-
-        // If uncompressed size is known, use it to avoid wasting memory for
-        // a uselessly large dictionary buffer.
-        dictSize = getDictSize(dictSize);
-        if (uncompSize >= 0 && dictSize > uncompSize)
-            dictSize = getDictSize((int)uncompSize);
-
-        lz = new LZDecoder(getDictSize(dictSize), presetDict, arrayCache);
-        rc = new RangeDecoderFromStream(in);
-        lzma = new LZMADecoder(lz, rc, lc, lp, pb);
-
-        remainingSize = uncompSize;
-    }
-
-    /**
-     * Decompresses the next byte from this input stream.
-     * <p>
-     * Reading lots of data with <code>read()</code> from this input stream
-     * may be inefficient. Wrap it in <code>java.io.BufferedInputStream</code>
-     * if you need to read lots of data one byte at a time.
-     *
-     * @return      the next decompressed byte, or <code>-1</code>
-     *              to indicate the end of the compressed stream
-     *
-     * @throws      CorruptedInputException
-     *
-     * @throws      XZIOException if the stream has been closed
-     *
-     * @throws      EOFException
-     *                          compressed input is truncated or corrupt
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public int read() throws IOException {
-        return read(tempBuf, 0, 1) == -1 ? -1 : (tempBuf[0] & 0xFF);
-    }
-
-    /**
-     * Decompresses into an array of bytes.
-     * <p>
-     * If <code>len</code> is zero, no bytes are read and <code>0</code>
-     * is returned. Otherwise this will block until <code>len</code>
-     * bytes have been decompressed, the end of the LZMA stream is reached,
-     * or an exception is thrown.
-     *
-     * @param       buf         target buffer for uncompressed data
-     * @param       off         start offset in <code>buf</code>
-     * @param       len         maximum number of uncompressed bytes to read
-     *
-     * @return      number of bytes read, or <code>-1</code> to indicate
-     *              the end of the compressed stream
-     *
-     * @throws      CorruptedInputException
-     *
-     * @throws      XZIOException if the stream has been closed
-     *
-     * @throws      EOFException compressed input is truncated or corrupt
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public int read(byte[] buf, int off, int len) throws IOException {
-        if (off < 0 || len < 0 || off + len < 0 || off + len > buf.length)
-            throw new IndexOutOfBoundsException();
-
-        if (len == 0)
-            return 0;
-
-        if (in == null)
-            throw new XZIOException("Stream closed");
-
-        if (exception != null)
-            throw exception;
-
-        if (endReached)
-            return -1;
-
-        try {
-            int size = 0;
-
-            while (len > 0) {
-                // If uncompressed size is known and thus no end marker will
-                // be present, set the limit so that the uncompressed size
-                // won't be exceeded.
-                int copySizeMax = len;
-                if (remainingSize >= 0 && remainingSize < len)
-                    copySizeMax = (int)remainingSize;
-
-                lz.setLimit(copySizeMax);
-
-                // Decode into the dictionary buffer.
-                try {
-                    lzma.decode();
-                } catch (CorruptedInputException e) {
-                    // The end marker is encoded with a LZMA symbol that
-                    // indicates maximum match distance. This is larger
-                    // than any supported dictionary and thus causes
-                    // CorruptedInputException from LZDecoder.repeat.
-                    if (remainingSize != -1 || !lzma.endMarkerDetected())
-                        throw e;
-
-                    endReached = true;
-
-                    // The exception makes lzma.decode() miss the last range
-                    // decoder normalization, so do it here. This might
-                    // cause an IOException if it needs to read a byte
-                    // from the input stream.
-                    rc.normalize();
-                }
-
-                // Copy from the dictionary to buf.
-                int copiedSize = lz.flush(buf, off);
-                off += copiedSize;
-                len -= copiedSize;
-                size += copiedSize;
-
-                if (remainingSize >= 0) {
-                    // Update the number of bytes left to be decompressed.
-                    remainingSize -= copiedSize;
-                    assert remainingSize >= 0;
-
-                    if (remainingSize == 0)
-                        endReached = true;
-                }
-
-                if (endReached) {
-                    // Checking these helps a lot when catching corrupt
-                    // or truncated .lzma files. LZMA Utils doesn't do
-                    // the first check and thus it accepts many invalid
-                    // files that this implementation and XZ Utils don't.
-                    if (!rc.isFinished() || lz.hasPending())
-                        throw new CorruptedInputException();
-
-                    putArraysToCache();
-                    return size == 0 ? -1 : size;
-                }
-            }
-
-            return size;
-
-        } catch (IOException e) {
-            exception = e;
-            throw e;
-        }
-    }
-
-    private void putArraysToCache() {
-        if (lz != null) {
-            lz.putArraysToCache(arrayCache);
-            lz = null;
-        }
-    }
-
-    /**
-     * Closes the stream and calls <code>in.close()</code>.
-     * If the stream was already closed, this does nothing.
-     *
-     * @throws  IOException if thrown by <code>in.close()</code>
-     */
-    public void close() throws IOException {
-        if (in != null) {
-            putArraysToCache();
-
-            try {
-                in.close();
-            } finally {
-                in = null;
-            }
-        }
-    }
-}
Index: unk/src/org/tukaani/xz/LZMAOutputStream.java
===================================================================
--- /trunk/src/org/tukaani/xz/LZMAOutputStream.java	(revision 13352)
+++ 	(revision )
@@ -1,331 +1,0 @@
-/*
- * LZMAOutputStream
- *
- * Authors: Lasse Collin <lasse.collin@tukaani.org>
- *          Igor Pavlov <http://7-zip.org/>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.OutputStream;
-import java.io.IOException;
-import org.tukaani.xz.lz.LZEncoder;
-import org.tukaani.xz.rangecoder.RangeEncoderToStream;
-import org.tukaani.xz.lzma.LZMAEncoder;
-
-/**
- * Compresses into the legacy .lzma file format or into a raw LZMA stream.
- *
- * @since 1.6
- */
-public class LZMAOutputStream extends FinishableOutputStream {
-    private OutputStream out;
-
-    private final ArrayCache arrayCache;
-
-    private LZEncoder lz;
-    private final RangeEncoderToStream rc;
-    private LZMAEncoder lzma;
-
-    private final int props;
-    private final boolean useEndMarker;
-    private final long expectedUncompressedSize;
-    private long currentUncompressedSize = 0;
-
-    private boolean finished = false;
-    private IOException exception = null;
-
-    private final byte[] tempBuf = new byte[1];
-
-    private LZMAOutputStream(OutputStream out, LZMA2Options options,
-                             boolean useHeader, boolean useEndMarker,
-                             long expectedUncompressedSize,
-                             ArrayCache arrayCache)
-            throws IOException {
-        if (out == null)
-            throw new NullPointerException();
-
-        // -1 indicates unknown and >= 0 are for known sizes.
-        if (expectedUncompressedSize < -1)
-            throw new IllegalArgumentException(
-                    "Invalid expected input size (less than -1)");
-
-        this.useEndMarker = useEndMarker;
-        this.expectedUncompressedSize = expectedUncompressedSize;
-
-        this.arrayCache = arrayCache;
-
-        this.out = out;
-        rc = new RangeEncoderToStream(out);
-
-        int dictSize = options.getDictSize();
-        lzma = LZMAEncoder.getInstance(rc,
-                options.getLc(), options.getLp(), options.getPb(),
-                options.getMode(),
-                dictSize, 0, options.getNiceLen(),
-                options.getMatchFinder(), options.getDepthLimit(),
-                arrayCache);
-
-        lz = lzma.getLZEncoder();
-
-        byte[] presetDict = options.getPresetDict();
-        if (presetDict != null && presetDict.length > 0) {
-            if (useHeader)
-                throw new UnsupportedOptionsException(
-                        "Preset dictionary cannot be used in .lzma files "
-                        + "(try a raw LZMA stream instead)");
-
-            lz.setPresetDict(dictSize, presetDict);
-        }
-
-        props = (options.getPb() * 5 + options.getLp()) * 9 + options.getLc();
-
-        if (useHeader) {
-            // Props byte stores lc, lp, and pb.
-            out.write(props);
-
-            // Dictionary size is stored as a 32-bit unsigned little endian
-            // integer.
-            for (int i = 0; i < 4; ++i) {
-                out.write(dictSize & 0xFF);
-                dictSize >>>= 8;
-            }
-
-            // Uncompressed size is stored as a 64-bit unsigned little endian
-            // integer. The max value (-1 in two's complement) indicates
-            // unknown size.
-            for (int i = 0; i < 8; ++i)
-                out.write((int)(expectedUncompressedSize >>> (8 * i)) & 0xFF);
-        }
-    }
-
-    /**
-     * Creates a new compressor for the legacy .lzma file format.
-     * <p>
-     * If the uncompressed size of the input data is known, it will be stored
-     * in the .lzma header and no end of stream marker will be used. Otherwise
-     * the header will indicate unknown uncompressed size and the end of stream
-     * marker will be used.
-     * <p>
-     * Note that a preset dictionary cannot be used in .lzma files but
-     * it can be used for raw LZMA streams.
-     *
-     * @param       out         output stream to which the compressed data
-     *                          will be written
-     *
-     * @param       options     LZMA compression options; the same class
-     *                          is used here as is for LZMA2
-     *
-     * @param       inputSize   uncompressed size of the data to be compressed;
-     *                          use <code>-1</code> when unknown
-     *
-     * @throws      IOException may be thrown from <code>out</code>
-     */
-    public LZMAOutputStream(OutputStream out, LZMA2Options options,
-                            long inputSize)
-            throws IOException {
-        this(out, options, inputSize, ArrayCache.getDefaultCache());
-    }
-
-    /**
-     * Creates a new compressor for the legacy .lzma file format.
-     * <p>
-     * This is identical to
-     * <code>LZMAOutputStream(OutputStream, LZMA2Options, long)</code>
-     * except that this also takes the <code>arrayCache</code> argument.
-     *
-     * @param       out         output stream to which the compressed data
-     *                          will be written
-     *
-     * @param       options     LZMA compression options; the same class
-     *                          is used here as is for LZMA2
-     *
-     * @param       inputSize   uncompressed size of the data to be compressed;
-     *                          use <code>-1</code> when unknown
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      IOException may be thrown from <code>out</code>
-     *
-     * @since 1.7
-     */
-    public LZMAOutputStream(OutputStream out, LZMA2Options options,
-                            long inputSize, ArrayCache arrayCache)
-            throws IOException {
-        this(out, options, true, inputSize == -1, inputSize, arrayCache);
-    }
-
-    /**
-     * Creates a new compressor for raw LZMA (also known as LZMA1) stream.
-     * <p>
-     * Raw LZMA streams can be encoded with or without end of stream marker.
-     * When decompressing the stream, one must know if the end marker was used
-     * and tell it to the decompressor. If the end marker wasn't used, the
-     * decompressor will also need to know the uncompressed size.
-     *
-     * @param       out         output stream to which the compressed data
-     *                          will be written
-     *
-     * @param       options     LZMA compression options; the same class
-     *                          is used here as is for LZMA2
-     *
-     * @param       useEndMarker
-     *                          if end of stream marker should be written
-     *
-     * @throws      IOException may be thrown from <code>out</code>
-     */
-    public LZMAOutputStream(OutputStream out, LZMA2Options options,
-                            boolean useEndMarker) throws IOException {
-        this(out, options, useEndMarker, ArrayCache.getDefaultCache());
-    }
-
-    /**
-     * Creates a new compressor for raw LZMA (also known as LZMA1) stream.
-     * <p>
-     * This is identical to
-     * <code>LZMAOutputStream(OutputStream, LZMA2Options, boolean)</code>
-     * except that this also takes the <code>arrayCache</code> argument.
-     *
-     * @param       out         output stream to which the compressed data
-     *                          will be written
-     *
-     * @param       options     LZMA compression options; the same class
-     *                          is used here as is for LZMA2
-     *
-     * @param       useEndMarker
-     *                          if end of stream marker should be written
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      IOException may be thrown from <code>out</code>
-     *
-     * @since 1.7
-     */
-    public LZMAOutputStream(OutputStream out, LZMA2Options options,
-                            boolean useEndMarker, ArrayCache arrayCache)
-            throws IOException {
-        this(out, options, false, useEndMarker, -1, arrayCache);
-    }
-
-    /**
-     * Returns the LZMA lc/lp/pb properties encoded into a single byte.
-     * This might be useful when handling file formats other than .lzma
-     * that use the same encoding for the LZMA properties as .lzma does.
-     */
-    public int getProps() {
-        return props;
-    }
-
-    /**
-     * Gets the amount of uncompressed data written to the stream.
-     * This is useful when creating raw LZMA streams without
-     * the end of stream marker.
-     */
-    public long getUncompressedSize() {
-        return currentUncompressedSize;
-    }
-
-    public void write(int b) throws IOException {
-        tempBuf[0] = (byte)b;
-        write(tempBuf, 0, 1);
-    }
-
-    public void write(byte[] buf, int off, int len) throws IOException {
-        if (off < 0 || len < 0 || off + len < 0 || off + len > buf.length)
-            throw new IndexOutOfBoundsException();
-
-        if (exception != null)
-            throw exception;
-
-        if (finished)
-            throw new XZIOException("Stream finished or closed");
-
-        if (expectedUncompressedSize != -1
-                && expectedUncompressedSize - currentUncompressedSize < len)
-            throw new XZIOException("Expected uncompressed input size ("
-                    + expectedUncompressedSize + " bytes) was exceeded");
-
-        currentUncompressedSize += len;
-
-        try {
-            while (len > 0) {
-                int used = lz.fillWindow(buf, off, len);
-                off += used;
-                len -= used;
-                lzma.encodeForLZMA1();
-            }
-        } catch (IOException e) {
-            exception = e;
-            throw e;
-        }
-    }
-
-    /**
-     * Flushing isn't supported and will throw XZIOException.
-     */
-    public void flush() throws IOException {
-        throw new XZIOException("LZMAOutputStream does not support flushing");
-    }
-
-    /**
-     * Finishes the stream without closing the underlying OutputStream.
-     */
-    public void finish() throws IOException {
-        if (!finished) {
-            if (exception != null)
-                throw exception;
-
-            try {
-                if (expectedUncompressedSize != -1
-                        && expectedUncompressedSize != currentUncompressedSize)
-                    throw new XZIOException("Expected uncompressed size ("
-                            + expectedUncompressedSize + ") doesn't equal "
-                            + "the number of bytes written to the stream ("
-                            + currentUncompressedSize + ")");
-
-                lz.setFinishing();
-                lzma.encodeForLZMA1();
-
-                if (useEndMarker)
-                    lzma.encodeLZMA1EndMarker();
-
-                rc.finish();
-            } catch (IOException e) {
-                exception = e;
-                throw e;
-            }
-
-            finished = true;
-
-            lzma.putArraysToCache(arrayCache);
-            lzma = null;
-            lz = null;
-        }
-    }
-
-    /**
-     * Finishes the stream and closes the underlying OutputStream.
-     */
-    public void close() throws IOException {
-        if (out != null) {
-            try {
-                finish();
-            } catch (IOException e) {}
-
-            try {
-                out.close();
-            } catch (IOException e) {
-                if (exception == null)
-                    exception = e;
-            }
-
-            out = null;
-        }
-
-        if (exception != null)
-            throw exception;
-    }
-}
Index: unk/src/org/tukaani/xz/PowerPCOptions.java
===================================================================
--- /trunk/src/org/tukaani/xz/PowerPCOptions.java	(revision 13352)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * PowerPCOptions
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.InputStream;
-import org.tukaani.xz.simple.PowerPC;
-
-/**
- * BCJ filter for big endian PowerPC instructions.
- */
-public class PowerPCOptions extends BCJOptions {
-    private static final int ALIGNMENT = 4;
-
-    public PowerPCOptions() {
-        super(ALIGNMENT);
-    }
-
-    public FinishableOutputStream getOutputStream(FinishableOutputStream out,
-                                                  ArrayCache arrayCache) {
-        return new SimpleOutputStream(out, new PowerPC(true, startOffset));
-    }
-
-    public InputStream getInputStream(InputStream in, ArrayCache arrayCache) {
-        return new SimpleInputStream(in, new PowerPC(false, startOffset));
-    }
-
-    FilterEncoder getFilterEncoder() {
-        return new BCJEncoder(this, BCJCoder.POWERPC_FILTER_ID);
-    }
-}
Index: unk/src/org/tukaani/xz/ResettableArrayCache.java
===================================================================
--- /trunk/src/org/tukaani/xz/ResettableArrayCache.java	(revision 13352)
+++ 	(revision )
@@ -1,120 +1,0 @@
-/*
- * ResettableArrayCache
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * An ArrayCache wrapper that remembers what has been allocated
- * and allows returning all allocations to the underlying cache at once.
- *
- * @since 1.7
- */
-public class ResettableArrayCache extends ArrayCache {
-    private final ArrayCache arrayCache;
-
-    // Lists of arrays that have been allocated from the arrayCache.
-    private final List<byte[]> byteArrays;
-    private final List<int[]> intArrays;
-
-    /**
-     * Creates a new ResettableArrayCache based on the given ArrayCache.
-     */
-    public ResettableArrayCache(ArrayCache arrayCache) {
-        this.arrayCache = arrayCache;
-
-        // Treat the dummy cache as a special case since it's a common case.
-        // With it we don't need to put the arrays back to the cache and
-        // thus we don't need to remember what has been allocated.
-        if (arrayCache == ArrayCache.getDummyCache()) {
-            byteArrays = null;
-            intArrays = null;
-        } else {
-            byteArrays = new ArrayList<byte[]>();
-            intArrays = new ArrayList<int[]>();
-        }
-    }
-
-    public byte[] getByteArray(int size, boolean fillWithZeros) {
-        byte[] array = arrayCache.getByteArray(size, fillWithZeros);
-
-        if (byteArrays != null) {
-            synchronized(byteArrays) {
-                byteArrays.add(array);
-            }
-        }
-
-        return array;
-    }
-
-    public void putArray(byte[] array) {
-        if (byteArrays != null) {
-            // The array is more likely to be near the end of the list so
-            // start the search from the end.
-            synchronized(byteArrays) {
-                int i = byteArrays.lastIndexOf(array);
-                if (i != -1)
-                    byteArrays.remove(i);
-            }
-
-            arrayCache.putArray(array);
-        }
-    }
-
-    public int[] getIntArray(int size, boolean fillWithZeros) {
-        int[] array = arrayCache.getIntArray(size, fillWithZeros);
-
-        if (intArrays != null) {
-            synchronized(intArrays) {
-                intArrays.add(array);
-            }
-        }
-
-        return array;
-    }
-
-    public void putArray(int[] array) {
-        if (intArrays != null) {
-            synchronized(intArrays) {
-                int i = intArrays.lastIndexOf(array);
-                if (i != -1)
-                    intArrays.remove(i);
-            }
-
-            arrayCache.putArray(array);
-        }
-    }
-
-    /**
-     * Puts all allocated arrays back to the underlying ArrayCache
-     * that haven't already been put there with a call to
-     * {@code putArray}.
-     */
-    public void reset() {
-        if (byteArrays != null) {
-            // Put the arrays to the cache in reverse order: the array that
-            // was allocated first is returned last.
-            synchronized(byteArrays) {
-                for (int i = byteArrays.size() - 1; i >= 0; --i)
-                    arrayCache.putArray(byteArrays.get(i));
-
-                byteArrays.clear();
-            }
-
-            synchronized(intArrays) {
-                for (int i = intArrays.size() - 1; i >= 0; --i)
-                    arrayCache.putArray(intArrays.get(i));
-
-                intArrays.clear();
-            }
-        }
-    }
-}
Index: unk/src/org/tukaani/xz/SPARCOptions.java
===================================================================
--- /trunk/src/org/tukaani/xz/SPARCOptions.java	(revision 13352)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * SPARCOptions
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.InputStream;
-import org.tukaani.xz.simple.SPARC;
-
-/**
- * BCJ filter for SPARC.
- */
-public class SPARCOptions extends BCJOptions {
-    private static final int ALIGNMENT = 4;
-
-    public SPARCOptions() {
-        super(ALIGNMENT);
-    }
-
-    public FinishableOutputStream getOutputStream(FinishableOutputStream out,
-                                                  ArrayCache arrayCache) {
-        return new SimpleOutputStream(out, new SPARC(true, startOffset));
-    }
-
-    public InputStream getInputStream(InputStream in, ArrayCache arrayCache) {
-        return new SimpleInputStream(in, new SPARC(false, startOffset));
-    }
-
-    FilterEncoder getFilterEncoder() {
-        return new BCJEncoder(this, BCJCoder.SPARC_FILTER_ID);
-    }
-}
Index: unk/src/org/tukaani/xz/SeekableFileInputStream.java
===================================================================
--- /trunk/src/org/tukaani/xz/SeekableFileInputStream.java	(revision 13352)
+++ 	(revision )
@@ -1,102 +1,0 @@
-/*
- * SeekableFileInputStream
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.File;
-import java.io.RandomAccessFile;
-import java.io.IOException;
-import java.io.FileNotFoundException;
-
-/**
- * Wraps a {@link java.io.RandomAccessFile RandomAccessFile}
- * in a SeekableInputStream.
- */
-public class SeekableFileInputStream extends SeekableInputStream {
-    /**
-     * The RandomAccessFile that has been wrapped
-     * into a SeekableFileInputStream.
-     */
-    protected RandomAccessFile randomAccessFile;
-
-    /**
-     * Creates a new seekable input stream that reads from the specified file.
-     */
-    public SeekableFileInputStream(File file) throws FileNotFoundException {
-        randomAccessFile = new RandomAccessFile(file, "r");
-    }
-
-    /**
-     * Creates a new seekable input stream that reads from a file with
-     * the specified name.
-     */
-    public SeekableFileInputStream(String name) throws FileNotFoundException {
-        randomAccessFile = new RandomAccessFile(name, "r");
-    }
-
-    /**
-     * Creates a new seekable input stream from an existing
-     * <code>RandomAccessFile</code> object.
-     */
-    public SeekableFileInputStream(RandomAccessFile randomAccessFile) {
-        this.randomAccessFile = randomAccessFile;
-    }
-
-    /**
-     * Calls {@link RandomAccessFile#read() randomAccessFile.read()}.
-     */
-    public int read() throws IOException {
-        return randomAccessFile.read();
-    }
-
-    /**
-     * Calls {@link RandomAccessFile#read(byte[]) randomAccessFile.read(buf)}.
-     */
-    public int read(byte[] buf) throws IOException {
-        return randomAccessFile.read(buf);
-    }
-
-    /**
-     * Calls
-     * {@link RandomAccessFile#read(byte[],int,int)
-     *        randomAccessFile.read(buf, off, len)}.
-     */
-    public int read(byte[] buf, int off, int len) throws IOException {
-        return randomAccessFile.read(buf, off, len);
-    }
-
-    /**
-     * Calls {@link RandomAccessFile#close() randomAccessFile.close()}.
-     */
-    public void close() throws IOException {
-        randomAccessFile.close();
-    }
-
-    /**
-     * Calls {@link RandomAccessFile#length() randomAccessFile.length()}.
-     */
-    public long length() throws IOException {
-        return randomAccessFile.length();
-    }
-
-    /**
-     * Calls {@link RandomAccessFile#getFilePointer()
-                    randomAccessFile.getFilePointer()}.
-     */
-    public long position() throws IOException {
-        return randomAccessFile.getFilePointer();
-    }
-
-    /**
-     * Calls {@link RandomAccessFile#seek(long) randomAccessFile.seek(long)}.
-     */
-    public void seek(long pos) throws IOException {
-        randomAccessFile.seek(pos);
-    }
-}
Index: unk/src/org/tukaani/xz/SeekableXZInputStream.java
===================================================================
--- /trunk/src/org/tukaani/xz/SeekableXZInputStream.java	(revision 13352)
+++ 	(revision )
@@ -1,1152 +1,0 @@
-/*
- * SeekableXZInputStream
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.io.DataInputStream;
-import java.io.IOException;
-import java.io.EOFException;
-import org.tukaani.xz.common.DecoderUtil;
-import org.tukaani.xz.common.StreamFlags;
-import org.tukaani.xz.check.Check;
-import org.tukaani.xz.index.IndexDecoder;
-import org.tukaani.xz.index.BlockInfo;
-
-/**
- * Decompresses a .xz file in random access mode.
- * This supports decompressing concatenated .xz files.
- * <p>
- * Each .xz file consist of one or more Streams. Each Stream consist of zero
- * or more Blocks. Each Stream contains an Index of Streams' Blocks.
- * The Indexes from all Streams are loaded in RAM by a constructor of this
- * class. A typical .xz file has only one Stream, and parsing its Index will
- * need only three or four seeks.
- * <p>
- * To make random access possible, the data in a .xz file must be splitted
- * into multiple Blocks of reasonable size. Decompression can only start at
- * a Block boundary. When seeking to an uncompressed position that is not at
- * a Block boundary, decompression starts at the beginning of the Block and
- * throws away data until the target position is reached. Thus, smaller Blocks
- * mean faster seeks to arbitrary uncompressed positions. On the other hand,
- * smaller Blocks mean worse compression. So one has to make a compromise
- * between random access speed and compression ratio.
- * <p>
- * Implementation note: This class uses linear search to locate the correct
- * Stream from the data structures in RAM. It was the simplest to implement
- * and should be fine as long as there aren't too many Streams. The correct
- * Block inside a Stream is located using binary search and thus is fast
- * even with a huge number of Blocks.
- *
- * <h4>Memory usage</h4>
- * <p>
- * The amount of memory needed for the Indexes is taken into account when
- * checking the memory usage limit. Each Stream is calculated to need at
- * least 1&nbsp;KiB of memory and each Block 16 bytes of memory, rounded up
- * to the next kibibyte. So unless the file has a huge number of Streams or
- * Blocks, these don't take significant amount of memory.
- *
- * <h4>Creating random-accessible .xz files</h4>
- * <p>
- * When using {@link XZOutputStream}, a new Block can be started by calling
- * its {@link XZOutputStream#endBlock() endBlock} method. If you know
- * that the decompressor will only need to seek to certain uncompressed
- * positions, it can be a good idea to start a new Block at (some of) these
- * positions (and only at these positions to get better compression ratio).
- * <p>
- * liblzma in XZ Utils supports starting a new Block with
- * <code>LZMA_FULL_FLUSH</code>. XZ Utils 5.1.1alpha added threaded
- * compression which creates multi-Block .xz files. XZ Utils 5.1.1alpha
- * also added the option <code>--block-size=SIZE</code> to the xz command
- * line tool. XZ Utils 5.1.2alpha added a partial implementation of
- * <code>--block-list=SIZES</code> which allows specifying sizes of
- * individual Blocks.
- *
- * @see SeekableFileInputStream
- * @see XZInputStream
- * @see XZOutputStream
- */
-public class SeekableXZInputStream extends SeekableInputStream {
-    /**
-     * Cache for big arrays.
-     */
-    private final ArrayCache arrayCache;
-
-    /**
-     * The input stream containing XZ compressed data.
-     */
-    private SeekableInputStream in;
-
-    /**
-     * Memory usage limit after the memory usage of the IndexDecoders have
-     * been substracted.
-     */
-    private final int memoryLimit;
-
-    /**
-     * Memory usage of the IndexDecoders.
-     * <code>memoryLimit + indexMemoryUsage</code> equals the original
-     * memory usage limit that was passed to the constructor.
-     */
-    private int indexMemoryUsage = 0;
-
-    /**
-     * List of IndexDecoders, one for each Stream in the file.
-     * The list is in reverse order: The first element is
-     * the last Stream in the file.
-     */
-    private final ArrayList<IndexDecoder> streams
-            = new ArrayList<IndexDecoder>();
-
-    /**
-     * Bitmask of all Check IDs seen.
-     */
-    private int checkTypes = 0;
-
-    /**
-     * Uncompressed size of the file (all Streams).
-     */
-    private long uncompressedSize = 0;
-
-    /**
-     * Uncompressed size of the largest XZ Block in the file.
-     */
-    private long largestBlockSize = 0;
-
-    /**
-     * Number of XZ Blocks in the file.
-     */
-    private int blockCount = 0;
-
-    /**
-     * Size and position information about the current Block.
-     * If there are no Blocks, all values will be <code>-1</code>.
-     */
-    private final BlockInfo curBlockInfo;
-
-    /**
-     * Temporary (and cached) information about the Block whose information
-     * is queried via <code>getBlockPos</code> and related functions.
-     */
-    private final BlockInfo queriedBlockInfo;
-
-    /**
-     * Integrity Check in the current XZ Stream. The constructor leaves
-     * this to point to the Check of the first Stream.
-     */
-    private Check check;
-
-    /**
-     * Flag indicating if the integrity checks will be verified.
-     */
-    private final boolean verifyCheck;
-
-    /**
-     * Decoder of the current XZ Block, if any.
-     */
-    private BlockInputStream blockDecoder = null;
-
-    /**
-     * Current uncompressed position.
-     */
-    private long curPos = 0;
-
-    /**
-     * Target position for seeking.
-     */
-    private long seekPos;
-
-    /**
-     * True when <code>seek(long)</code> has been called but the actual
-     * seeking hasn't been done yet.
-     */
-    private boolean seekNeeded = false;
-
-    /**
-     * True when end of the file was reached. This can be cleared by
-     * calling <code>seek(long)</code>.
-     */
-    private boolean endReached = false;
-
-    /**
-     * Pending exception from an earlier error.
-     */
-    private IOException exception = null;
-
-    /**
-     * Temporary buffer for read(). This avoids reallocating memory
-     * on every read() call.
-     */
-    private final byte[] tempBuf = new byte[1];
-
-    /**
-     * Creates a new seekable XZ decompressor without a memory usage limit.
-     *
-     * @param       in          seekable input stream containing one or more
-     *                          XZ Streams; the whole input stream is used
-     *
-     * @throws      XZFormatException
-     *                          input is not in the XZ format
-     *
-     * @throws      CorruptedInputException
-     *                          XZ data is corrupt or truncated
-     *
-     * @throws      UnsupportedOptionsException
-     *                          XZ headers seem valid but they specify
-     *                          options not supported by this implementation
-     *
-     * @throws      EOFException
-     *                          less than 6 bytes of input was available
-     *                          from <code>in</code>, or (unlikely) the size
-     *                          of the underlying stream got smaller while
-     *                          this was reading from it
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public SeekableXZInputStream(SeekableInputStream in)
-            throws IOException {
-        this(in, -1);
-    }
-
-    /**
-     * Creates a new seekable XZ decompressor without a memory usage limit.
-     * <p>
-     * This is identical to
-     * <code>SeekableXZInputStream(SeekableInputStream)</code> except that
-     * this also takes the <code>arrayCache</code> argument.
-     *
-     * @param       in          seekable input stream containing one or more
-     *                          XZ Streams; the whole input stream is used
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      XZFormatException
-     *                          input is not in the XZ format
-     *
-     * @throws      CorruptedInputException
-     *                          XZ data is corrupt or truncated
-     *
-     * @throws      UnsupportedOptionsException
-     *                          XZ headers seem valid but they specify
-     *                          options not supported by this implementation
-     *
-     * @throws      EOFException
-     *                          less than 6 bytes of input was available
-     *                          from <code>in</code>, or (unlikely) the size
-     *                          of the underlying stream got smaller while
-     *                          this was reading from it
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     *
-     * @since 1.7
-     */
-    public SeekableXZInputStream(SeekableInputStream in, ArrayCache arrayCache)
-            throws IOException {
-        this(in, -1, arrayCache);
-    }
-
-    /**
-     * Creates a new seekable XZ decomporessor with an optional
-     * memory usage limit.
-     *
-     * @param       in          seekable input stream containing one or more
-     *                          XZ Streams; the whole input stream is used
-     *
-     * @param       memoryLimit memory usage limit in kibibytes (KiB)
-     *                          or <code>-1</code> to impose no
-     *                          memory usage limit
-     *
-     * @throws      XZFormatException
-     *                          input is not in the XZ format
-     *
-     * @throws      CorruptedInputException
-     *                          XZ data is corrupt or truncated
-     *
-     * @throws      UnsupportedOptionsException
-     *                          XZ headers seem valid but they specify
-     *                          options not supported by this implementation
-     *
-     * @throws      MemoryLimitException
-     *                          decoded XZ Indexes would need more memory
-     *                          than allowed by the memory usage limit
-     *
-     * @throws      EOFException
-     *                          less than 6 bytes of input was available
-     *                          from <code>in</code>, or (unlikely) the size
-     *                          of the underlying stream got smaller while
-     *                          this was reading from it
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public SeekableXZInputStream(SeekableInputStream in, int memoryLimit)
-            throws IOException {
-        this(in, memoryLimit, true);
-    }
-
-    /**
-     * Creates a new seekable XZ decomporessor with an optional
-     * memory usage limit.
-     * <p>
-     * This is identical to
-     * <code>SeekableXZInputStream(SeekableInputStream,int)</code>
-     * except that this also takes the <code>arrayCache</code> argument.
-     *
-     * @param       in          seekable input stream containing one or more
-     *                          XZ Streams; the whole input stream is used
-     *
-     * @param       memoryLimit memory usage limit in kibibytes (KiB)
-     *                          or <code>-1</code> to impose no
-     *                          memory usage limit
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      XZFormatException
-     *                          input is not in the XZ format
-     *
-     * @throws      CorruptedInputException
-     *                          XZ data is corrupt or truncated
-     *
-     * @throws      UnsupportedOptionsException
-     *                          XZ headers seem valid but they specify
-     *                          options not supported by this implementation
-     *
-     * @throws      MemoryLimitException
-     *                          decoded XZ Indexes would need more memory
-     *                          than allowed by the memory usage limit
-     *
-     * @throws      EOFException
-     *                          less than 6 bytes of input was available
-     *                          from <code>in</code>, or (unlikely) the size
-     *                          of the underlying stream got smaller while
-     *                          this was reading from it
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     *
-     * @since 1.7
-     */
-    public SeekableXZInputStream(SeekableInputStream in, int memoryLimit,
-                                 ArrayCache arrayCache)
-            throws IOException {
-        this(in, memoryLimit, true, arrayCache);
-    }
-
-    /**
-     * Creates a new seekable XZ decomporessor with an optional
-     * memory usage limit and ability to disable verification
-     * of integrity checks.
-     * <p>
-     * Note that integrity check verification should almost never be disabled.
-     * Possible reasons to disable integrity check verification:
-     * <ul>
-     *   <li>Trying to recover data from a corrupt .xz file.</li>
-     *   <li>Speeding up decompression. This matters mostly with SHA-256
-     *   or with files that have compressed extremely well. It's recommended
-     *   that integrity checking isn't disabled for performance reasons
-     *   unless the file integrity is verified externally in some other
-     *   way.</li>
-     * </ul>
-     * <p>
-     * <code>verifyCheck</code> only affects the integrity check of
-     * the actual compressed data. The CRC32 fields in the headers
-     * are always verified.
-     *
-     * @param       in          seekable input stream containing one or more
-     *                          XZ Streams; the whole input stream is used
-     *
-     * @param       memoryLimit memory usage limit in kibibytes (KiB)
-     *                          or <code>-1</code> to impose no
-     *                          memory usage limit
-     *
-     * @param       verifyCheck if <code>true</code>, the integrity checks
-     *                          will be verified; this should almost never
-     *                          be set to <code>false</code>
-     *
-     * @throws      XZFormatException
-     *                          input is not in the XZ format
-     *
-     * @throws      CorruptedInputException
-     *                          XZ data is corrupt or truncated
-     *
-     * @throws      UnsupportedOptionsException
-     *                          XZ headers seem valid but they specify
-     *                          options not supported by this implementation
-     *
-     * @throws      MemoryLimitException
-     *                          decoded XZ Indexes would need more memory
-     *                          than allowed by the memory usage limit
-     *
-     * @throws      EOFException
-     *                          less than 6 bytes of input was available
-     *                          from <code>in</code>, or (unlikely) the size
-     *                          of the underlying stream got smaller while
-     *                          this was reading from it
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     *
-     * @since 1.6
-     */
-    public SeekableXZInputStream(SeekableInputStream in, int memoryLimit,
-                                 boolean verifyCheck)
-            throws IOException {
-        this(in, memoryLimit, verifyCheck, ArrayCache.getDefaultCache());
-    }
-
-    /**
-     * Creates a new seekable XZ decomporessor with an optional
-     * memory usage limit and ability to disable verification
-     * of integrity checks.
-     * <p>
-     * This is identical to
-     * <code>SeekableXZInputStream(SeekableInputStream,int,boolean)</code>
-     * except that this also takes the <code>arrayCache</code> argument.
-     *
-     * @param       in          seekable input stream containing one or more
-     *                          XZ Streams; the whole input stream is used
-     *
-     * @param       memoryLimit memory usage limit in kibibytes (KiB)
-     *                          or <code>-1</code> to impose no
-     *                          memory usage limit
-     *
-     * @param       verifyCheck if <code>true</code>, the integrity checks
-     *                          will be verified; this should almost never
-     *                          be set to <code>false</code>
-     *
-     * @param       arrayCache  cache to be used for allocating large arrays
-     *
-     * @throws      XZFormatException
-     *                          input is not in the XZ format
-     *
-     * @throws      CorruptedInputException
-     *                          XZ data is corrupt or truncated
-     *
-     * @throws      UnsupportedOptionsException
-     *                          XZ headers seem valid but they specify
-     *                          options not supported by this implementation
-     *
-     * @throws      MemoryLimitException
-     *                          decoded XZ Indexes would need more memory
-     *                          than allowed by the memory usage limit
-     *
-     * @throws      EOFException
-     *                          less than 6 bytes of input was available
-     *                          from <code>in</code>, or (unlikely) the size
-     *                          of the underlying stream got smaller while
-     *                          this was reading from it
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     *
-     * @since 1.7
-     */
-    public SeekableXZInputStream(SeekableInputStream in, int memoryLimit,
-                                 boolean verifyCheck, ArrayCache arrayCache)
-            throws IOException {
-        this.arrayCache = arrayCache;
-        this.verifyCheck = verifyCheck;
-        this.in = in;
-        DataInputStream inData = new DataInputStream(in);
-
-        // Check the magic bytes in the beginning of the file.
-        {
-            in.seek(0);
-            byte[] buf = new byte[XZ.HEADER_MAGIC.length];
-            inData.readFully(buf);
-            if (!Arrays.equals(buf, XZ.HEADER_MAGIC))
-                throw new XZFormatException();
-        }
-
-        // Get the file size and verify that it is a multiple of 4 bytes.
-        long pos = in.length();
-        if ((pos & 3) != 0)
-            throw new CorruptedInputException(
-                    "XZ file size is not a multiple of 4 bytes");
-
-        // Parse the headers starting from the end of the file.
-        byte[] buf = new byte[DecoderUtil.STREAM_HEADER_SIZE];
-        long streamPadding = 0;
-
-        while (pos > 0) {
-            if (pos < DecoderUtil.STREAM_HEADER_SIZE)
-                throw new CorruptedInputException();
-
-            // Read the potential Stream Footer.
-            in.seek(pos - DecoderUtil.STREAM_HEADER_SIZE);
-            inData.readFully(buf);
-
-            // Skip Stream Padding four bytes at a time.
-            // Skipping more at once would be faster,
-            // but usually there isn't much Stream Padding.
-            if (buf[8] == 0x00 && buf[9] == 0x00 && buf[10] == 0x00
-                    && buf[11] == 0x00) {
-                streamPadding += 4;
-                pos -= 4;
-                continue;
-            }
-
-            // It's not Stream Padding. Update pos.
-            pos -= DecoderUtil.STREAM_HEADER_SIZE;
-
-            // Decode the Stream Footer and check if Backward Size
-            // looks reasonable.
-            StreamFlags streamFooter = DecoderUtil.decodeStreamFooter(buf);
-            if (streamFooter.backwardSize >= pos)
-                throw new CorruptedInputException(
-                        "Backward Size in XZ Stream Footer is too big");
-
-            // Check that the Check ID is supported. Store it in case this
-            // is the first Stream in the file.
-            check = Check.getInstance(streamFooter.checkType);
-
-            // Remember which Check IDs have been seen.
-            checkTypes |= 1 << streamFooter.checkType;
-
-            // Seek to the beginning of the Index.
-            in.seek(pos - streamFooter.backwardSize);
-
-            // Decode the Index field.
-            IndexDecoder index;
-            try {
-                index = new IndexDecoder(in, streamFooter, streamPadding,
-                                         memoryLimit);
-            } catch (MemoryLimitException e) {
-                // IndexDecoder doesn't know how much memory we had
-                // already needed so we need to recreate the exception.
-                assert memoryLimit >= 0;
-                throw new MemoryLimitException(
-                        e.getMemoryNeeded() + indexMemoryUsage,
-                        memoryLimit + indexMemoryUsage);
-            }
-
-            // Update the memory usage and limit counters.
-            indexMemoryUsage += index.getMemoryUsage();
-            if (memoryLimit >= 0) {
-                memoryLimit -= index.getMemoryUsage();
-                assert memoryLimit >= 0;
-            }
-
-            // Remember the uncompressed size of the largest Block.
-            if (largestBlockSize < index.getLargestBlockSize())
-                largestBlockSize = index.getLargestBlockSize();
-
-            // Calculate the offset to the beginning of this XZ Stream and
-            // check that it looks sane.
-            long off = index.getStreamSize() - DecoderUtil.STREAM_HEADER_SIZE;
-            if (pos < off)
-                throw new CorruptedInputException("XZ Index indicates "
-                        + "too big compressed size for the XZ Stream");
-
-            // Seek to the beginning of this Stream.
-            pos -= off;
-            in.seek(pos);
-
-            // Decode the Stream Header.
-            inData.readFully(buf);
-            StreamFlags streamHeader = DecoderUtil.decodeStreamHeader(buf);
-
-            // Verify that the Stream Header matches the Stream Footer.
-            if (!DecoderUtil.areStreamFlagsEqual(streamHeader, streamFooter))
-                throw new CorruptedInputException(
-                        "XZ Stream Footer does not match Stream Header");
-
-            // Update the total uncompressed size of the file and check that
-            // it doesn't overflow.
-            uncompressedSize += index.getUncompressedSize();
-            if (uncompressedSize < 0)
-                throw new UnsupportedOptionsException("XZ file is too big");
-
-            // Update the Block count and check that it fits into an int.
-            blockCount += index.getRecordCount();
-            if (blockCount < 0)
-                throw new UnsupportedOptionsException(
-                        "XZ file has over " + Integer.MAX_VALUE + " Blocks");
-
-            // Add this Stream to the list of Streams.
-            streams.add(index);
-
-            // Reset to be ready to parse the next Stream.
-            streamPadding = 0;
-        }
-
-        assert pos == 0;
-
-        // Save it now that indexMemoryUsage has been substracted from it.
-        this.memoryLimit = memoryLimit;
-
-        // Store the relative offsets of the Streams. This way we don't
-        // need to recalculate them in this class when seeking; the
-        // IndexDecoder instances will handle them.
-        IndexDecoder prev = streams.get(streams.size() - 1);
-        for (int i = streams.size() - 2; i >= 0; --i) {
-            IndexDecoder cur = streams.get(i);
-            cur.setOffsets(prev);
-            prev = cur;
-        }
-
-        // Initialize curBlockInfo to point to the first Stream.
-        // The blockNumber will be left to -1 so that .hasNext()
-        // and .setNext() work to get the first Block when starting
-        // to decompress from the beginning of the file.
-        IndexDecoder first = streams.get(streams.size() - 1);
-        curBlockInfo = new BlockInfo(first);
-
-        // queriedBlockInfo needs to be allocated too. The Stream used for
-        // initialization doesn't matter though.
-        queriedBlockInfo = new BlockInfo(first);
-    }
-
-    /**
-     * Gets the types of integrity checks used in the .xz file.
-     * Multiple checks are possible only if there are multiple
-     * concatenated XZ Streams.
-     * <p>
-     * The returned value has a bit set for every check type that is present.
-     * For example, if CRC64 and SHA-256 were used, the return value is
-     * <code>(1&nbsp;&lt;&lt;&nbsp;XZ.CHECK_CRC64)
-     * | (1&nbsp;&lt;&lt;&nbsp;XZ.CHECK_SHA256)</code>.
-     */
-    public int getCheckTypes() {
-        return checkTypes;
-    }
-
-    /**
-     * Gets the amount of memory in kibibytes (KiB) used by
-     * the data structures needed to locate the XZ Blocks.
-     * This is usually useless information but since it is calculated
-     * for memory usage limit anyway, it is nice to make it available to too.
-     */
-    public int getIndexMemoryUsage() {
-        return indexMemoryUsage;
-    }
-
-    /**
-     * Gets the uncompressed size of the largest XZ Block in bytes.
-     * This can be useful if you want to check that the file doesn't
-     * have huge XZ Blocks which could make seeking to arbitrary offsets
-     * very slow. Note that huge Blocks don't automatically mean that
-     * seeking would be slow, for example, seeking to the beginning of
-     * any Block is always fast.
-     */
-    public long getLargestBlockSize() {
-        return largestBlockSize;
-    }
-
-    /**
-     * Gets the number of Streams in the .xz file.
-     *
-     * @since 1.3
-     */
-    public int getStreamCount() {
-        return streams.size();
-    }
-
-    /**
-     * Gets the number of Blocks in the .xz file.
-     *
-     * @since 1.3
-     */
-    public int getBlockCount() {
-        return blockCount;
-    }
-
-    /**
-     * Gets the uncompressed start position of the given Block.
-     *
-     * @throws  IndexOutOfBoundsException if
-     *          <code>blockNumber&nbsp;&lt;&nbsp;0</code> or
-     *          <code>blockNumber&nbsp;&gt;=&nbsp;getBlockCount()</code>.
-     *
-     * @since 1.3
-     */
-    public long getBlockPos(int blockNumber) {
-        locateBlockByNumber(queriedBlockInfo, blockNumber);
-        return queriedBlockInfo.uncompressedOffset;
-    }
-
-    /**
-     * Gets the uncompressed size of the given Block.
-     *
-     * @throws  IndexOutOfBoundsException if
-     *          <code>blockNumber&nbsp;&lt;&nbsp;0</code> or
-     *          <code>blockNumber&nbsp;&gt;=&nbsp;getBlockCount()</code>.
-     *
-     * @since 1.3
-     */
-    public long getBlockSize(int blockNumber) {
-        locateBlockByNumber(queriedBlockInfo, blockNumber);
-        return queriedBlockInfo.uncompressedSize;
-    }
-
-    /**
-     * Gets the position where the given compressed Block starts in
-     * the underlying .xz file.
-     * This information is rarely useful to the users of this class.
-     *
-     * @throws  IndexOutOfBoundsException if
-     *          <code>blockNumber&nbsp;&lt;&nbsp;0</code> or
-     *          <code>blockNumber&nbsp;&gt;=&nbsp;getBlockCount()</code>.
-     *
-     * @since 1.3
-     */
-    public long getBlockCompPos(int blockNumber) {
-        locateBlockByNumber(queriedBlockInfo, blockNumber);
-        return queriedBlockInfo.compressedOffset;
-    }
-
-    /**
-     * Gets the compressed size of the given Block.
-     * This together with the uncompressed size can be used to calculate
-     * the compression ratio of the specific Block.
-     *
-     * @throws  IndexOutOfBoundsException if
-     *          <code>blockNumber&nbsp;&lt;&nbsp;0</code> or
-     *          <code>blockNumber&nbsp;&gt;=&nbsp;getBlockCount()</code>.
-     *
-     * @since 1.3
-     */
-    public long getBlockCompSize(int blockNumber) {
-        locateBlockByNumber(queriedBlockInfo, blockNumber);
-        return (queriedBlockInfo.unpaddedSize + 3) & ~3;
-    }
-
-    /**
-     * Gets integrity check type (Check ID) of the given Block.
-     *
-     * @throws  IndexOutOfBoundsException if
-     *          <code>blockNumber&nbsp;&lt;&nbsp;0</code> or
-     *          <code>blockNumber&nbsp;&gt;=&nbsp;getBlockCount()</code>.
-     *
-     * @see #getCheckTypes()
-     *
-     * @since 1.3
-     */
-    public int getBlockCheckType(int blockNumber) {
-        locateBlockByNumber(queriedBlockInfo, blockNumber);
-        return queriedBlockInfo.getCheckType();
-    }
-
-    /**
-     * Gets the number of the Block that contains the byte at the given
-     * uncompressed position.
-     *
-     * @throws  IndexOutOfBoundsException if
-     *          <code>pos&nbsp;&lt;&nbsp;0</code> or
-     *          <code>pos&nbsp;&gt;=&nbsp;length()</code>.
-     *
-     * @since 1.3
-     */
-    public int getBlockNumber(long pos) {
-        locateBlockByPos(queriedBlockInfo, pos);
-        return queriedBlockInfo.blockNumber;
-    }
-
-    /**
-     * Decompresses the next byte from this input stream.
-     *
-     * @return      the next decompressed byte, or <code>-1</code>
-     *              to indicate the end of the compressed stream
-     *
-     * @throws      CorruptedInputException
-     * @throws      UnsupportedOptionsException
-     * @throws      MemoryLimitException
-     *
-     * @throws      XZIOException if the stream has been closed
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public int read() throws IOException {
-        return read(tempBuf, 0, 1) == -1 ? -1 : (tempBuf[0] & 0xFF);
-    }
-
-    /**
-     * Decompresses into an array of bytes.
-     * <p>
-     * If <code>len</code> is zero, no bytes are read and <code>0</code>
-     * is returned. Otherwise this will try to decompress <code>len</code>
-     * bytes of uncompressed data. Less than <code>len</code> bytes may
-     * be read only in the following situations:
-     * <ul>
-     *   <li>The end of the compressed data was reached successfully.</li>
-     *   <li>An error is detected after at least one but less than
-     *       <code>len</code> bytes have already been successfully
-     *       decompressed. The next call with non-zero <code>len</code>
-     *       will immediately throw the pending exception.</li>
-     *   <li>An exception is thrown.</li>
-     * </ul>
-     *
-     * @param       buf         target buffer for uncompressed data
-     * @param       off         start offset in <code>buf</code>
-     * @param       len         maximum number of uncompressed bytes to read
-     *
-     * @return      number of bytes read, or <code>-1</code> to indicate
-     *              the end of the compressed stream
-     *
-     * @throws      CorruptedInputException
-     * @throws      UnsupportedOptionsException
-     * @throws      MemoryLimitException
-     *
-     * @throws      XZIOException if the stream has been closed
-     *
-     * @throws      IOException may be thrown by <code>in</code>
-     */
-    public int read(byte[] buf, int off, int len) throws IOException {
-        if (off < 0 || len < 0 || off + len < 0 || off + len > buf.length)
-            throw new IndexOutOfBoundsException();
-
-        if (len == 0)
-            return 0;
-
-        if (in == null)
-            throw new XZIOException("Stream closed");
-
-        if (exception != null)
-            throw exception;
-
-        int size = 0;
-
-        try {
-            if (seekNeeded)
-                seek();
-
-            if (endReached)
-                return -1;
-
-            while (len > 0) {
-                if (blockDecoder == null) {
-                    seek();
-                    if (endReached)
-                        break;
-                }
-
-                int ret = blockDecoder.read(buf, off, len);
-
-                if (ret > 0) {
-                    curPos += ret;
-                    size += ret;
-                    off += ret;
-                    len -= ret;
-                } else if (ret == -1) {
-                    blockDecoder = null;
-                }
-            }
-        } catch (IOException e) {
-            // We know that the file isn't simply truncated because we could
-            // parse the Indexes in the constructor. So convert EOFException
-            // to CorruptedInputException.
-            if (e instanceof EOFException)
-                e = new CorruptedInputException();
-
-            exception = e;
-            if (size == 0)
-                throw e;
-        }
-
-        return size;
-    }
-
-    /**
-     * Returns the number of uncompressed bytes that can be read
-     * without blocking. The value is returned with an assumption
-     * that the compressed input data will be valid. If the compressed
-     * data is corrupt, <code>CorruptedInputException</code> may get
-     * thrown before the number of bytes claimed to be available have
-     * been read from this input stream.
-     *
-     * @return      the number of uncompressed bytes that can be read
-     *              without blocking
-     */
-    public int available() throws IOException {
-        if (in == null)
-            throw new XZIOException("Stream closed");
-
-        if (exception != null)
-            throw exception;
-
-        if (endReached || seekNeeded || blockDecoder == null)
-            return 0;
-
-        return blockDecoder.available();
-    }
-
-    /**
-     * Closes the stream and calls <code>in.close()</code>.
-     * If the stream was already closed, this does nothing.
-     * <p>
-     * This is equivalent to <code>close(true)</code>.
-     *
-     * @throws  IOException if thrown by <code>in.close()</code>
-     */
-    public void close() throws IOException {
-        close(true);
-    }
-
-    /**
-     * Closes the stream and optionally calls <code>in.close()</code>.
-     * If the stream was already closed, this does nothing.
-     * If <code>close(false)</code> has been called, a further
-     * call of <code>close(true)</code> does nothing (it doesn't call
-     * <code>in.close()</code>).
-     * <p>
-     * If you don't want to close the underlying <code>InputStream</code>,
-     * there is usually no need to worry about closing this stream either;
-     * it's fine to do nothing and let the garbage collector handle it.
-     * However, if you are using {@link ArrayCache}, <code>close(false)</code>
-     * can be useful to put the allocated arrays back to the cache without
-     * closing the underlying <code>InputStream</code>.
-     * <p>
-     * Note that if you successfully reach the end of the stream
-     * (<code>read</code> returns <code>-1</code>), the arrays are
-     * automatically put back to the cache by that <code>read</code> call. In
-     * this situation <code>close(false)</code> is redundant (but harmless).
-     *
-     * @throws  IOException if thrown by <code>in.close()</code>
-     *
-     * @since 1.7
-     */
-    public void close(boolean closeInput) throws IOException {
-        if (in != null) {
-            if (blockDecoder != null) {
-                blockDecoder.close();
-                blockDecoder = null;
-            }
-
-            try {
-                if (closeInput)
-                    in.close();
-            } finally {
-                in = null;
-            }
-        }
-    }
-
-    /**
-     * Gets the uncompressed size of this input stream. If there are multiple
-     * XZ Streams, the total uncompressed size of all XZ Streams is returned.
-     */
-    public long length() {
-        return uncompressedSize;
-    }
-
-    /**
-     * Gets the current uncompressed position in this input stream.
-     *
-     * @throws      XZIOException if the stream has been closed
-     */
-    public long position() throws IOException {
-        if (in == null)
-            throw new XZIOException("Stream closed");
-
-        return seekNeeded ? seekPos : curPos;
-    }
-
-    /**
-     * Seeks to the specified absolute uncompressed position in the stream.
-     * This only stores the new position, so this function itself is always
-     * very fast. The actual seek is done when <code>read</code> is called
-     * to read at least one byte.
-     * <p>
-     * Seeking past the end of the stream is possible. In that case
-     * <code>read</code> will return <code>-1</code> to indicate
-     * the end of the stream.
-     *
-     * @param       pos         new uncompressed read position
-     *
-     * @throws      XZIOException
-     *                          if <code>pos</code> is negative, or
-     *                          if stream has been closed
-     */
-    public void seek(long pos) throws IOException {
-        if (in == null)
-            throw new XZIOException("Stream closed");
-
-        if (pos < 0)
-            throw new XZIOException("Negative seek position: " + pos);
-
-        seekPos = pos;
-        seekNeeded = true;
-    }
-
-    /**
-     * Seeks to the beginning of the given XZ Block.
-     *
-     * @throws      XZIOException
-     *              if <code>blockNumber&nbsp;&lt;&nbsp;0</code> or
-     *              <code>blockNumber&nbsp;&gt;=&nbsp;getBlockCount()</code>,
-     *              or if stream has been closed
-     *
-     * @since 1.3
-     */
-    public void seekToBlock(int blockNumber) throws IOException {
-        if (in == null)
-            throw new XZIOException("Stream closed");
-
-        if (blockNumber < 0 || blockNumber >= blockCount)
-            throw new XZIOException("Invalid XZ Block number: " + blockNumber);
-
-        // This is a bit silly implementation. Here we locate the uncompressed
-        // offset of the specified Block, then when doing the actual seek in
-        // seek(), we need to find the Block number based on seekPos.
-        seekPos = getBlockPos(blockNumber);
-        seekNeeded = true;
-    }
-
-    /**
-     * Does the actual seeking. This is also called when <code>read</code>
-     * needs a new Block to decode.
-     */
-    private void seek() throws IOException {
-        // If seek(long) wasn't called, we simply need to get the next Block
-        // from the same Stream. If there are no more Blocks in this Stream,
-        // then we behave as if seek(long) had been called.
-        if (!seekNeeded) {
-            if (curBlockInfo.hasNext()) {
-                curBlockInfo.setNext();
-                initBlockDecoder();
-                return;
-            }
-
-            seekPos = curPos;
-        }
-
-        seekNeeded = false;
-
-        // Check if we are seeking to or past the end of the file.
-        if (seekPos >= uncompressedSize) {
-            curPos = seekPos;
-
-            if (blockDecoder != null) {
-                blockDecoder.close();
-                blockDecoder = null;
-            }
-
-            endReached = true;
-            return;
-        }
-
-        endReached = false;
-
-        // Locate the Block that contains the uncompressed target position.
-        locateBlockByPos(curBlockInfo, seekPos);
-
-        // Seek in the underlying stream and create a new Block decoder
-        // only if really needed. We can skip it if the current position
-        // is already in the correct Block and the target position hasn't
-        // been decompressed yet.
-        //
-        // NOTE: If curPos points to the beginning of this Block, it's
-        // because it was left there after decompressing an earlier Block.
-        // In that case, decoding of the current Block hasn't been started
-        // yet. (Decoding of a Block won't be started until at least one
-        // byte will also be read from it.)
-        if (!(curPos > curBlockInfo.uncompressedOffset && curPos <= seekPos)) {
-            // Seek to the beginning of the Block.
-            in.seek(curBlockInfo.compressedOffset);
-
-            // Since it is possible that this Block is from a different
-            // Stream than the previous Block, initialize a new Check.
-            check = Check.getInstance(curBlockInfo.getCheckType());
-
-            // Create a new Block decoder.
-            initBlockDecoder();
-            curPos = curBlockInfo.uncompressedOffset;
-        }
-
-        // If the target wasn't at a Block boundary, decompress and throw
-        // away data to reach the target position.
-        if (seekPos > curPos) {
-            // NOTE: The "if" below is there just in case. In this situation,
-            // blockDecoder.skip will always skip the requested amount
-            // or throw an exception.
-            long skipAmount = seekPos - curPos;
-            if (blockDecoder.skip(skipAmount) != skipAmount)
-                throw new CorruptedInputException();
-
-            curPos = seekPos;
-        }
-    }
-
-    /**
-     * Locates the Block that contains the given uncompressed position.
-     */
-    private void locateBlockByPos(BlockInfo info, long pos) {
-        if (pos < 0 || pos >= uncompressedSize)
-            throw new IndexOutOfBoundsException(
-                    "Invalid uncompressed position: " + pos);
-
-        // Locate the Stream that contains the target position.
-        IndexDecoder index;
-        for (int i = 0; ; ++i) {
-            index = streams.get(i);
-            if (index.hasUncompressedOffset(pos))
-                break;
-        }
-
-        // Locate the Block from the Stream that contains the target position.
-        index.locateBlock(info, pos);
-
-        assert (info.compressedOffset & 3) == 0;
-        assert info.uncompressedSize > 0;
-        assert pos >= info.uncompressedOffset;
-        assert pos < info.uncompressedOffset + info.uncompressedSize;
-    }
-
-    /**
-     * Locates the given Block and stores information about it
-     * to <code>info</code>.
-     */
-    private void locateBlockByNumber(BlockInfo info, int blockNumber) {
-        // Validate.
-        if (blockNumber < 0 || blockNumber >= blockCount)
-            throw new IndexOutOfBoundsException(
-                    "Invalid XZ Block number: " + blockNumber);
-
-        // Skip the search if info already points to the correct Block.
-        if (info.blockNumber == blockNumber)
-            return;
-
-        // Search the Stream that contains the given Block and then
-        // search the Block from that Stream.
-        for (int i = 0; ; ++i) {
-            IndexDecoder index = streams.get(i);
-            if (index.hasRecord(blockNumber)) {
-                index.setBlockInfo(info, blockNumber);
-                return;
-            }
-        }
-    }
-
-    /**
-     * Initializes a new BlockInputStream. This is a helper function for
-     * <code>seek()</code>.
-     */
-    private void initBlockDecoder() throws IOException {
-        try {
-            // Set it to null first so that GC can collect it if memory
-            // runs tight when initializing a new BlockInputStream.
-            if (blockDecoder != null) {
-                blockDecoder.close();
-                blockDecoder = null;
-            }
-
-            blockDecoder = new BlockInputStream(
-                    in, check, verifyCheck, memoryLimit,
-                    curBlockInfo.unpaddedSize, curBlockInfo.uncompressedSize,
-                    arrayCache);
-        } catch (MemoryLimitException e) {
-            // BlockInputStream doesn't know how much memory we had
-            // already needed so we need to recreate the exception.
-            assert memoryLimit >= 0;
-            throw new MemoryLimitException(
-                    e.getMemoryNeeded() + indexMemoryUsage,
-                    memoryLimit + indexMemoryUsage);
-        } catch (IndexIndicatorException e) {
-            // It cannot be Index so the file must be corrupt.
-            throw new CorruptedInputException();
-        }
-    }
-}
Index: unk/src/org/tukaani/xz/SimpleOutputStream.java
===================================================================
--- /trunk/src/org/tukaani/xz/SimpleOutputStream.java	(revision 13352)
+++ 	(revision )
@@ -1,151 +1,0 @@
-/*
- * SimpleOutputStream
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.IOException;
-import org.tukaani.xz.simple.SimpleFilter;
-
-class SimpleOutputStream extends FinishableOutputStream {
-    private static final int FILTER_BUF_SIZE = 4096;
-
-    private FinishableOutputStream out;
-    private final SimpleFilter simpleFilter;
-
-    private final byte[] filterBuf = new byte[FILTER_BUF_SIZE];
-    private int pos = 0;
-    private int unfiltered = 0;
-
-    private IOException exception = null;
-    private boolean finished = false;
-
-    private final byte[] tempBuf = new byte[1];
-
-    static int getMemoryUsage() {
-        return 1 + FILTER_BUF_SIZE / 1024;
-    }
-
-    SimpleOutputStream(FinishableOutputStream out,
-                       SimpleFilter simpleFilter) {
-        if (out == null)
-            throw new NullPointerException();
-
-        this.out = out;
-        this.simpleFilter = simpleFilter;
-    }
-
-    public void write(int b) throws IOException {
-        tempBuf[0] = (byte)b;
-        write(tempBuf, 0, 1);
-    }
-
-    public void write(byte[] buf, int off, int len) throws IOException {
-        if (off < 0 || len < 0 || off + len < 0 || off + len > buf.length)
-            throw new IndexOutOfBoundsException();
-
-        if (exception != null)
-            throw exception;
-
-        if (finished)
-            throw new XZIOException("Stream finished or closed");
-
-        while (len > 0) {
-            // Copy more unfiltered data into filterBuf.
-            int copySize = Math.min(len, FILTER_BUF_SIZE - (pos + unfiltered));
-            System.arraycopy(buf, off, filterBuf, pos + unfiltered, copySize);
-            off += copySize;
-            len -= copySize;
-            unfiltered += copySize;
-
-            // Filter the data in filterBuf.
-            int filtered = simpleFilter.code(filterBuf, pos, unfiltered);
-            assert filtered <= unfiltered;
-            unfiltered -= filtered;
-
-            // Write out the filtered data.
-            try {
-                out.write(filterBuf, pos, filtered);
-            } catch (IOException e) {
-                exception = e;
-                throw e;
-            }
-
-            pos += filtered;
-
-            // If end of filterBuf was reached, move the pending unfiltered
-            // data to the beginning of the buffer so that more data can
-            // be copied into filterBuf on the next loop iteration.
-            if (pos + unfiltered == FILTER_BUF_SIZE) {
-                System.arraycopy(filterBuf, pos, filterBuf, 0, unfiltered);
-                pos = 0;
-            }
-        }
-    }
-
-    private void writePending() throws IOException {
-        assert !finished;
-
-        if (exception != null)
-            throw exception;
-
-        try {
-            out.write(filterBuf, pos, unfiltered);
-        } catch (IOException e) {
-            exception = e;
-            throw e;
-        }
-
-        finished = true;
-    }
-
-    public void flush() throws IOException {
-        throw new UnsupportedOptionsException("Flushing is not supported");
-    }
-
-    public void finish() throws IOException {
-        if (!finished) {
-            // If it fails, don't call out.finish().
-            writePending();
-
-            try {
-                out.finish();
-            } catch (IOException e) {
-                exception = e;
-                throw e;
-            }
-        }
-    }
-
-    public void close() throws IOException {
-        if (out != null) {
-            if (!finished) {
-                // out.close() must be called even if writePending() fails.
-                // writePending() saves the possible exception so we can
-                // ignore exceptions here.
-                try {
-                    writePending();
-                } catch (IOException e) {}
-            }
-
-            try {
-                out.close();
-            } catch (IOException e) {
-                // If there is an earlier exception, the exception
-                // from out.close() is lost.
-                if (exception == null)
-                    exception = e;
-            }
-
-            out = null;
-        }
-
-        if (exception != null)
-            throw exception;
-    }
-}
Index: unk/src/org/tukaani/xz/X86Options.java
===================================================================
--- /trunk/src/org/tukaani/xz/X86Options.java	(revision 13352)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * X86Options
- *
- * Author: Lasse Collin <lasse.collin@tukaani.org>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz;
-
-import java.io.InputStream;
-import org.tukaani.xz.simple.X86;
-
-/**
- * BCJ filter for x86 (32-bit and 64-bit) instructions.
- */
-public class X86Options extends BCJOptions {
-    private static final int ALIGNMENT = 1;
-
-    public X86Options() {
-        super(ALIGNMENT);
-    }
-
-    public FinishableOutputStream getOutputStream(FinishableOutputStream out,
-                                                  ArrayCache arrayCache) {
-        return new SimpleOutputStream(out, new X86(true, startOffset));
-    }
-
-    public InputStream getInputStream(InputStream in, ArrayCache arrayCache) {
-        return new SimpleInputStream(in, new X86(false, startOffset));
-    }
-
-    FilterEncoder getFilterEncoder() {
-        return new BCJEncoder(this, BCJCoder.X86_FILTER_ID);
-    }
-}
Index: unk/src/org/tukaani/xz/rangecoder/RangeDecoderFromStream.java
===================================================================
--- /trunk/src/org/tukaani/xz/rangecoder/RangeDecoderFromStream.java	(revision 13352)
+++ 	(revision )
@@ -1,41 +1,0 @@
-/*
- * RangeDecoderFromStream
- *
- * Authors: Lasse Collin <lasse.collin@tukaani.org>
- *          Igor Pavlov <http://7-zip.org/>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz.rangecoder;
-
-import java.io.InputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-import org.tukaani.xz.CorruptedInputException;
-
-public final class RangeDecoderFromStream extends RangeDecoder {
-    private final DataInputStream inData;
-
-    public RangeDecoderFromStream(InputStream in) throws IOException {
-        inData = new DataInputStream(in);
-
-        if (inData.readUnsignedByte() != 0x00)
-            throw new CorruptedInputException();
-
-        code = inData.readInt();
-        range = 0xFFFFFFFF;
-    }
-
-    public boolean isFinished() {
-        return code == 0;
-    }
-
-    public void normalize() throws IOException {
-        if ((range & TOP_MASK) == 0) {
-            code = (code << SHIFT_BITS) | inData.readUnsignedByte();
-            range <<= SHIFT_BITS;
-        }
-    }
-}
Index: unk/src/org/tukaani/xz/rangecoder/RangeEncoderToStream.java
===================================================================
--- /trunk/src/org/tukaani/xz/rangecoder/RangeEncoderToStream.java	(revision 13352)
+++ 	(revision )
@@ -1,27 +1,0 @@
-/*
- * RangeEncoderToStream
- *
- * Authors: Lasse Collin <lasse.collin@tukaani.org>
- *          Igor Pavlov <http://7-zip.org/>
- *
- * This file has been put into the public domain.
- * You can do whatever you want with this file.
- */
-
-package org.tukaani.xz.rangecoder;
-
-import java.io.OutputStream;
-import java.io.IOException;
-
-public final class RangeEncoderToStream extends RangeEncoder {
-    private final OutputStream out;
-
-    public RangeEncoderToStream(OutputStream out) {
-        this.out = out;
-        reset();
-    }
-
-    void writeByte(int b) throws IOException {
-        out.write(b);
-    }
-}
