bundles/org.tukani.xz/src/org/tukaani/xz/XZOutputStream.java
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");

        try {
            if (blockEncoder == null)
                blockEncoder = new BlockOutputStream(out, filters, check,
                                                     arrayCache);

            blockEncoder.write(buf, off, len);
        } catch (IOException e) {
            exception = e;
            throw e;
        }
    }
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");

        try {
            if (blockEncoder == null)
                blockEncoder = new BlockOutputStream(out, filters, check,
                                                     arrayCache);

            blockEncoder.write(buf, off, len);
        } catch (IOException e) {
            exception = e;
            throw e;
        }
    }
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" ) ; try { if ( blockEncoder == null ) blockEncoder = new BlockOutputStream ( out , filters , check , arrayCache ) ; blockEncoder . write ( buf , off , len ) ; } catch ( IOException e ) { exception = e ; throw e ; } }
Writes an array of bytes to be compressed.
The compressors tend to do internal buffering and thus the written
data won't be readable from the compressed output immediately.
Use <code>flush()</code> to force everything written so far to
be written to the underlaying output stream, but be aware that
flushing reduces compression ratio.

@param       buf         buffer of bytes to be written
@param       off         start offset in <code>buf</code>
@param       len         number of bytes to write

@throws      XZIOException
XZ Stream has grown too big: total file size
about 8&nbsp;EiB or the Index field exceeds
16&nbsp;GiB; you shouldn't reach these sizes
in practice

@throws      XZIOException
<code>finish()</code> or <code>close()</code>
was already called and len &gt; 0

@throws      IOException may be thrown by the underlying output stream
Writes an array of bytes to be compressed . The compressors tend to do internal buffering and thus the written data won t be readable from the compressed output immediately . Use <code > flush () < / code > to force everything written so far to be written to the underlaying output stream but be aware that flushing reduces compression ratio .