Top Description Fields Constructors Methods
org.tukaani.xz

public Class DeltaOptions

extends FilterOptions
Class Inheritance
Imports
java.io.InputStream

Delta filter options. The Delta filter can be used only as a non-last filter in the chain, for example Delta + LZMA2.

Currently only simple byte-wise delta is supported. The only option is the delta distance, which you should set to match your data. It's not possible to provide a generic default value for it.

For example, with distance = 2 and eight-byte input A1 B1 A2 B3 A3 B5 A4 B7, the output will be A1 B1 01 02 01 02 01 02.

The Delta filter can be good with uncompressed bitmap images. It can also help with PCM audio, although special-purpose compressors like FLAC will give much smaller result at much better compression speed.

Field Summary

Modifier and TypeField and Description
private int
public static final int
DISTANCE_MAX

Largest supported delta calculation distance.

public static final int
DISTANCE_MIN

Smallest supported delta calculation distance.

Constructor Summary

AccessConstructor and Description
public
DeltaOptions()

Creates new Delta options and sets the delta distance to 1 byte.

public
DeltaOptions(int distance)

Creates new Delta options and sets the distance to the given value.

Method Summary

Modifier and TypeMethod and Description
public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.
public int
getDecoderMemoryUsage()

Implements abstract org.tukaani.xz.FilterOptions.getDecoderMemoryUsage.

Gets how much memory the decoder will need to decompress the data that was encoded with these options.
public int
getDistance()

Gets the delta distance.

public int
getEncoderMemoryUsage()

Implements abstract org.tukaani.xz.FilterOptions.getEncoderMemoryUsage.

Gets how much memory the encoder will need with these options.
pack-priv FilterEncoder
public InputStream
getInputStream(InputStream in, ArrayCache arrayCache)

Implements abstract org.tukaani.xz.FilterOptions.getInputStream.

Gets a raw (no XZ headers) decoder input stream using these options and the given ArrayCache.
public FinishableOutputStream
getOutputStream(FinishableOutputStream out, ArrayCache arrayCache)

Implements abstract org.tukaani.xz.FilterOptions.getOutputStream.

Gets a raw (no XZ headers) encoder output stream using these options and the given ArrayCache.
public void
setDistance(int distance)

Sets the delta distance in bytes.

Inherited from org.tukaani.xz.FilterOptions:
getDecoderMemoryUsagegetEncoderMemoryUsagegetInputStreamgetOutputStream

Field Detail

distanceback to summary
private int distance
DISTANCE_MAXback to summary
public static final int DISTANCE_MAX

Largest supported delta calculation distance.

DISTANCE_MINback to summary
public static final int DISTANCE_MIN

Smallest supported delta calculation distance.

Constructor Detail

DeltaOptionsback to summary
public DeltaOptions()

Creates new Delta options and sets the delta distance to 1 byte.

DeltaOptionsback to summary
public DeltaOptions(int distance) throws UnsupportedOptionsException

Creates new Delta options and sets the distance to the given value.

Method Detail

cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

Returns:Object

a clone of this instance.

getDecoderMemoryUsageback to summary
public int getDecoderMemoryUsage()

Implements abstract org.tukaani.xz.FilterOptions.getDecoderMemoryUsage.

Doc from org.tukaani.xz.FilterOptions.getDecoderMemoryUsage.

Gets how much memory the decoder will need to decompress the data that was encoded with these options.

getDistanceback to summary
public int getDistance()

Gets the delta distance.

getEncoderMemoryUsageback to summary
public int getEncoderMemoryUsage()

Implements abstract org.tukaani.xz.FilterOptions.getEncoderMemoryUsage.

Doc from org.tukaani.xz.FilterOptions.getEncoderMemoryUsage.

Gets how much memory the encoder will need with these options.

getFilterEncoderback to summary
pack-priv FilterEncoder getFilterEncoder()

Implements abstract org.tukaani.xz.FilterOptions.getFilterEncoder.

getInputStreamback to summary
public InputStream getInputStream(InputStream in, ArrayCache arrayCache)

Implements abstract org.tukaani.xz.FilterOptions.getInputStream.

Doc from org.tukaani.xz.FilterOptions.getInputStream.

Gets a raw (no XZ headers) decoder input stream using these options and the given ArrayCache.

getOutputStreamback to summary
public FinishableOutputStream getOutputStream(FinishableOutputStream out, ArrayCache arrayCache)

Implements abstract org.tukaani.xz.FilterOptions.getOutputStream.

Doc from org.tukaani.xz.FilterOptions.getOutputStream.

Gets a raw (no XZ headers) encoder output stream using these options and the given ArrayCache. Raw streams are an advanced feature. In most cases you want to store the compressed data in the .xz container format instead of using a raw stream. To use this filter in a .xz file, pass this object to XZOutputStream.

setDistanceback to summary
public void setDistance(int distance) throws UnsupportedOptionsException

Sets the delta distance in bytes. The new distance must be in the range [DISTANCE_MIN, DISTANCE_MAX].