Top Description Constructors Methods
com.ning.compress.lzf.util

public Class ChunkEncoderFactory

extends Object
Class Inheritance
Imports
com.ning.compress.BufferRecycler, com.ning.compress.lzf.ChunkEncoder, .LZFChunk, com.ning.compress.lzf.impl.UnsafeChunkEncoders, .VanillaChunkEncoder

Simple helper class used for loading ChunkEncoder implementations, based on criteria such as "fastest available" or "safe to run anywhere".

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public static ChunkEncoder

Returns:

ChunkEncoder constructed
optimalInstance
()

Convenience method, equivalent to: return optimalInstance(LZFChunk.MAX_CHUNK_LEN);

public static ChunkEncoder

Returns:

ChunkEncoder constructed
optimalInstance
(int
Expected total length of content to compress; only matters for content that is smaller than maximum chunk size (64k), to optimize encoding hash tables
totalLength
)

Method to use for getting compressor instance that uses the most optimal available methods for underlying data access.

public static ChunkEncoder

Returns:

ChunkEncoder constructed
optimalInstance
(BufferRecycler bufferRecycler)

Convenience method, equivalent to: return optimalInstance(LZFChunk.MAX_CHUNK_LEN, bufferRecycler);

public static ChunkEncoder

Returns:

ChunkEncoder constructed
optimalInstance
(int
Expected total length of content to compress; only matters for content that is smaller than maximum chunk size (64k), to optimize encoding hash tables
totalLength
,
BufferRecycler
The BufferRecycler instance
bufferRecycler
)

Method to use for getting compressor instance that uses the most optimal available methods for underlying data access.

public static ChunkEncoder

Returns:

ChunkEncoder constructed
optimalNonAllocatingInstance
(int totalLength)

Factory method for constructing encoder that is always passed buffer externally, so that it will not (nor need) allocate encoding buffer.

public static ChunkEncoder

Returns:

ChunkEncoder constructed
optimalNonAllocatingInstance
(int totalLength, BufferRecycler bufferRecycler)

Factory method for constructing encoder that is always passed buffer externally, so that it will not (nor need) allocate encoding buffer.

public static ChunkEncoder

Returns:

ChunkEncoder constructed
safeInstance
()

Convenience method, equivalent to: return safeInstance(LZFChunk.MAX_CHUNK_LEN);

public static ChunkEncoder

Returns:

ChunkEncoder constructed
safeInstance
(int
Expected total length of content to compress; only matters for content that is smaller than maximum chunk size (64k), to optimize encoding hash tables
totalLength
)

Method that can be used to ensure that a "safe" compressor instance is loaded.

public static ChunkEncoder

Returns:

ChunkEncoder constructed
safeInstance
(BufferRecycler bufferRecycler)

Convenience method, equivalent to: return safeInstance(LZFChunk.MAX_CHUNK_LEN, bufferRecycler);

public static ChunkEncoder

Returns:

ChunkEncoder constructed
safeInstance
(int
Expected total length of content to compress; only matters for content that is smaller than maximum chunk size (64k), to optimize encoding hash tables
totalLength
,
BufferRecycler
The BufferRecycler instance
bufferRecycler
)

Method that can be used to ensure that a "safe" compressor instance is loaded.

public static ChunkEncoder

Returns:

ChunkEncoder constructed
safeNonAllocatingInstance
(int totalLength)

Factory method for constructing encoder that is always passed buffer externally, so that it will not (nor need) allocate encoding buffer.

public static ChunkEncoder
safeNonAllocatingInstance(int totalLength, BufferRecycler bufferRecycler)

Factory method for constructing encoder that is always passed buffer externally, so that it will not (nor need) allocate encoding buffer.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ChunkEncoderFactoryback to summary
public ChunkEncoderFactory()

Method Detail

optimalInstanceback to summary
public static ChunkEncoder optimalInstance()

Convenience method, equivalent to: return optimalInstance(LZFChunk.MAX_CHUNK_LEN);

Returns:ChunkEncoder

ChunkEncoder constructed

optimalInstanceback to summary
public static ChunkEncoder optimalInstance(int totalLength)

Method to use for getting compressor instance that uses the most optimal available methods for underlying data access. It should be safe to call this method as implementations are dynamically loaded; however, on some non-standard platforms it may be necessary to either directly load instances, or use safeInstance.

Uses a ThreadLocal soft-referenced BufferRecycler instance.

Parameters
totalLength:int

Expected total length of content to compress; only matters for content that is smaller than maximum chunk size (64k), to optimize encoding hash tables

Returns:ChunkEncoder

ChunkEncoder constructed

optimalInstanceback to summary
public static ChunkEncoder optimalInstance(BufferRecycler bufferRecycler)

Convenience method, equivalent to: return optimalInstance(LZFChunk.MAX_CHUNK_LEN, bufferRecycler);

Returns:ChunkEncoder

ChunkEncoder constructed

optimalInstanceback to summary
public static ChunkEncoder optimalInstance(int totalLength, BufferRecycler bufferRecycler)

Method to use for getting compressor instance that uses the most optimal available methods for underlying data access. It should be safe to call this method as implementations are dynamically loaded; however, on some non-standard platforms it may be necessary to either directly load instances, or use safeInstance.

Parameters
totalLength:int

Expected total length of content to compress; only matters for content that is smaller than maximum chunk size (64k), to optimize encoding hash tables

bufferRecycler:BufferRecycler

The BufferRecycler instance

Returns:ChunkEncoder

ChunkEncoder constructed

optimalNonAllocatingInstanceback to summary
public static ChunkEncoder optimalNonAllocatingInstance(int totalLength)

Factory method for constructing encoder that is always passed buffer externally, so that it will not (nor need) allocate encoding buffer.

Uses a ThreadLocal soft-referenced BufferRecycler instance.

Returns:ChunkEncoder

ChunkEncoder constructed

optimalNonAllocatingInstanceback to summary
public static ChunkEncoder optimalNonAllocatingInstance(int totalLength, BufferRecycler bufferRecycler)

Factory method for constructing encoder that is always passed buffer externally, so that it will not (nor need) allocate encoding buffer.

Returns:ChunkEncoder

ChunkEncoder constructed

safeInstanceback to summary
public static ChunkEncoder safeInstance()

Convenience method, equivalent to: return safeInstance(LZFChunk.MAX_CHUNK_LEN);

Returns:ChunkEncoder

ChunkEncoder constructed

safeInstanceback to summary
public static ChunkEncoder safeInstance(int totalLength)

Method that can be used to ensure that a "safe" compressor instance is loaded. Safe here means that it should work on any and all Java platforms.

Uses a ThreadLocal soft-referenced BufferRecycler instance.

Parameters
totalLength:int

Expected total length of content to compress; only matters for content that is smaller than maximum chunk size (64k), to optimize encoding hash tables

Returns:ChunkEncoder

ChunkEncoder constructed

safeInstanceback to summary
public static ChunkEncoder safeInstance(BufferRecycler bufferRecycler)

Convenience method, equivalent to: return safeInstance(LZFChunk.MAX_CHUNK_LEN, bufferRecycler);

Returns:ChunkEncoder

ChunkEncoder constructed

safeInstanceback to summary
public static ChunkEncoder safeInstance(int totalLength, BufferRecycler bufferRecycler)

Method that can be used to ensure that a "safe" compressor instance is loaded. Safe here means that it should work on any and all Java platforms.

Parameters
totalLength:int

Expected total length of content to compress; only matters for content that is smaller than maximum chunk size (64k), to optimize encoding hash tables

bufferRecycler:BufferRecycler

The BufferRecycler instance

Returns:ChunkEncoder

ChunkEncoder constructed

safeNonAllocatingInstanceback to summary
public static ChunkEncoder safeNonAllocatingInstance(int totalLength)

Factory method for constructing encoder that is always passed buffer externally, so that it will not (nor need) allocate encoding buffer.

Uses a ThreadLocal soft-referenced BufferRecycler instance.

Returns:ChunkEncoder

ChunkEncoder constructed

safeNonAllocatingInstanceback to summary
public static ChunkEncoder safeNonAllocatingInstance(int totalLength, BufferRecycler bufferRecycler)

Factory method for constructing encoder that is always passed buffer externally, so that it will not (nor need) allocate encoding buffer.