/** * Alternate constructor used when we want to avoid allocation encoding * buffer, in cases where caller wants full control over allocations. */ protected ChunkEncoder(int totalLength, BufferRecycler bufferRecycler, boolean bogus) { int largestChunkLen = Math.max(totalLength, LZFChunk.MAX_CHUNK_LEN); int suggestedHashLen = calcHashLen(largestChunkLen); _recycler = bufferRecycler; _hashTable = bufferRecycler.allocEncodingHash(suggestedHashLen); _hashModulo = _hashTable.length - 1; _encodeBuffer = null; }
/** * Alternate constructor used when we want to avoid allocation encoding * buffer, in cases where caller wants full control over allocations. */ protected ChunkEncoder(int totalLength, BufferRecycler bufferRecycler, boolean bogus) { int largestChunkLen = Math.max(totalLength, LZFChunk.MAX_CHUNK_LEN); int suggestedHashLen = calcHashLen(largestChunkLen); _recycler = bufferRecycler; _hashTable = bufferRecycler.allocEncodingHash(suggestedHashLen); _hashModulo = _hashTable.length - 1; _encodeBuffer = null; }
/** * Alternate constructor used when we want to avoid allocation encoding * buffer, in cases where caller wants full control over allocations. */ protected ChunkEncoder(int totalLength, BufferRecycler bufferRecycler, boolean bogus) { int largestChunkLen = Math.max(totalLength, LZFChunk.MAX_CHUNK_LEN); int suggestedHashLen = calcHashLen(largestChunkLen); _recycler = bufferRecycler; _hashTable = bufferRecycler.allocEncodingHash(suggestedHashLen); _hashModulo = _hashTable.length - 1; _encodeBuffer = null; }
/** * @param totalLength Total encoded length; used for calculating size * of hash table to use * @param bufferRecycler Buffer recycler instance, for usages where the * caller manages the recycler instances */ protected ChunkEncoder(int totalLength, BufferRecycler bufferRecycler) { // Need room for at most a single full chunk int largestChunkLen = Math.min(totalLength, LZFChunk.MAX_CHUNK_LEN); int suggestedHashLen = calcHashLen(largestChunkLen); _recycler = bufferRecycler; _hashTable = bufferRecycler.allocEncodingHash(suggestedHashLen); _hashModulo = _hashTable.length - 1; // Ok, then, what's the worst case output buffer length? // length indicator for each 32 literals, so: // 21-Feb-2013, tatu: Plus we want to prepend chunk header in place: int bufferLen = largestChunkLen + ((largestChunkLen + 31) >> 5) + LZFChunk.MAX_HEADER_LEN; _encodeBuffer = bufferRecycler.allocEncodingBuffer(bufferLen); }
/** * @param totalLength Total encoded length; used for calculating size * of hash table to use * @param bufferRecycler Buffer recycler instance, for usages where the * caller manages the recycler instances */ protected ChunkEncoder(int totalLength, BufferRecycler bufferRecycler) { // Need room for at most a single full chunk int largestChunkLen = Math.min(totalLength, LZFChunk.MAX_CHUNK_LEN); int suggestedHashLen = calcHashLen(largestChunkLen); _recycler = bufferRecycler; _hashTable = bufferRecycler.allocEncodingHash(suggestedHashLen); _hashModulo = _hashTable.length - 1; // Ok, then, what's the worst case output buffer length? // length indicator for each 32 literals, so: // 21-Feb-2013, tatu: Plus we want to prepend chunk header in place: int bufferLen = largestChunkLen + ((largestChunkLen + 31) >> 5) + LZFChunk.MAX_HEADER_LEN; _encodeBuffer = bufferRecycler.allocEncodingBuffer(bufferLen); }
/** * @param totalLength Total encoded length; used for calculating size * of hash table to use * @param bufferRecycler Buffer recycler instance, for usages where the * caller manages the recycler instances */ protected ChunkEncoder(int totalLength, BufferRecycler bufferRecycler) { // Need room for at most a single full chunk int largestChunkLen = Math.min(totalLength, LZFChunk.MAX_CHUNK_LEN); int suggestedHashLen = calcHashLen(largestChunkLen); _recycler = bufferRecycler; _hashTable = bufferRecycler.allocEncodingHash(suggestedHashLen); _hashModulo = _hashTable.length - 1; // Ok, then, what's the worst case output buffer length? // length indicator for each 32 literals, so: // 21-Feb-2013, tatu: Plus we want to prepend chunk header in place: int bufferLen = largestChunkLen + ((largestChunkLen + 31) >> 5) + LZFChunk.MAX_HEADER_LEN; _encodeBuffer = bufferRecycler.allocEncodingBuffer(bufferLen); }