/** * @return Length of the next chunk to allocate */ public final T appendCompletedChunk(T fullChunk, int fullChunkLength) { Node<T> next = new Node<T>(fullChunk, fullChunkLength); if (_bufferHead == null) { // first chunk _bufferHead = _bufferTail = next; } else { // have something already _bufferTail.linkNext(next); _bufferTail = next; } _bufferedEntryCount += fullChunkLength; int nextLen = fullChunkLength; // start with last chunk size // double the size for small chunks if (nextLen < SMALL_CHUNK_SIZE) { nextLen += nextLen; } else { // but by +25% for larger (to limit overhead) nextLen += (nextLen >> 2); } return _constructArray(nextLen); }
/** * @return Length of the next chunk to allocate */ public final T appendCompletedChunk(T fullChunk, int fullChunkLength) { Node<T> next = new Node<T>(fullChunk, fullChunkLength); if (_bufferHead == null) { // first chunk _bufferHead = _bufferTail = next; } else { // have something already _bufferTail.linkNext(next); _bufferTail = next; } _bufferedEntryCount += fullChunkLength; int nextLen = fullChunkLength; // start with last chunk size // double the size for small chunks if (nextLen < SMALL_CHUNK_SIZE) { nextLen += nextLen; } else { // but by +25% for larger (to limit overhead) nextLen += (nextLen >> 2); } return _constructArray(nextLen); }
/** * @return Length of the next chunk to allocate */ public final T appendCompletedChunk(T fullChunk, int fullChunkLength) { Node<T> next = new Node<T>(fullChunk, fullChunkLength); if (_bufferHead == null) { // first chunk _bufferHead = _bufferTail = next; } else { // have something already _bufferTail.linkNext(next); _bufferTail = next; } _bufferedEntryCount += fullChunkLength; int nextLen = fullChunkLength; // start with last chunk size // double the size for small chunks if (nextLen < SMALL_CHUNK_SIZE) { nextLen += nextLen; } else { // but by +25% for larger (to limit overhead) nextLen += (nextLen >> 2); } return _constructArray(nextLen); }
/** * @return Length of the next chunk to allocate */ public final T appendCompletedChunk(T fullChunk, int fullChunkLength) { Node<T> next = new Node<T>(fullChunk, fullChunkLength); if (_bufferHead == null) { // first chunk _bufferHead = _bufferTail = next; } else { // have something already _bufferTail.linkNext(next); _bufferTail = next; } _bufferedEntryCount += fullChunkLength; int nextLen = fullChunkLength; // start with last chunk size // double the size for small chunks if (nextLen < SMALL_CHUNK_SIZE) { nextLen += nextLen; } else { // but by +25% for larger (to limit overhead) nextLen += (nextLen >> 2); } return _constructArray(nextLen); }
/** * @return Length of the next chunk to allocate */ public final T appendCompletedChunk(T fullChunk, int fullChunkLength) { Node<T> next = new Node<T>(fullChunk, fullChunkLength); if (_bufferHead == null) { // first chunk _bufferHead = _bufferTail = next; } else { // have something already _bufferTail.linkNext(next); _bufferTail = next; } _bufferedEntryCount += fullChunkLength; int nextLen = fullChunkLength; // start with last chunk size // double the size for small chunks if (nextLen < SMALL_CHUNK_SIZE) { nextLen += nextLen; } else { // but by +25% for larger (to limit overhead) nextLen += (nextLen >> 2); } return _constructArray(nextLen); }
/** * @return Length of the next chunk to allocate */ public final T appendCompletedChunk(T fullChunk, int fullChunkLength) { Node<T> next = new Node<T>(fullChunk, fullChunkLength); if (_bufferHead == null) { // first chunk _bufferHead = _bufferTail = next; } else { // have something already _bufferTail.linkNext(next); _bufferTail = next; } _bufferedEntryCount += fullChunkLength; int nextLen = fullChunkLength; // start with last chunk size // double the size for small chunks if (nextLen < SMALL_CHUNK_SIZE) { nextLen += nextLen; } else { // but by +25% for larger (to limit overhead) nextLen += (nextLen >> 2); } return _constructArray(nextLen); }