fix buffer recycler in lzf
This commit is contained in:
parent
9c6dfc1508
commit
768c6d2922
|
@ -34,7 +34,7 @@ public class BufferRecycler {
|
||||||
private final static int MIN_OUTPUT_BUFFER = 8000;
|
private final static int MIN_OUTPUT_BUFFER = 8000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This <code>ThreadLocal</code> contains a {@link java.lang.ref.SoftRerefence}
|
* This <code>ThreadLocal</code> contains a {@link java.lang.ref.SoftReference}
|
||||||
* to a {@link BufferRecycler} used to provide a low-cost
|
* to a {@link BufferRecycler} used to provide a low-cost
|
||||||
* buffer recycling for buffers we need for encoding, decoding.
|
* buffer recycling for buffers we need for encoding, decoding.
|
||||||
*/
|
*/
|
||||||
|
@ -101,7 +101,7 @@ public class BufferRecycler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseOutputBuffer(byte[] buffer) {
|
public void releaseOutputBuffer(byte[] buffer) {
|
||||||
if (_outputBuffer == null || buffer.length > _outputBuffer.length) {
|
if (_outputBuffer == null || (buffer != null && buffer.length > _outputBuffer.length)) {
|
||||||
_outputBuffer = buffer;
|
_outputBuffer = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -117,7 +117,7 @@ public class BufferRecycler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseEncodingHash(int[] buffer) {
|
public void releaseEncodingHash(int[] buffer) {
|
||||||
if (_encodingHash == null || buffer.length > _encodingHash.length) {
|
if (_encodingHash == null || (buffer != null && buffer.length > _encodingHash.length)) {
|
||||||
_encodingHash = buffer;
|
_encodingHash = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ public class BufferRecycler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseInputBuffer(byte[] buffer) {
|
public void releaseInputBuffer(byte[] buffer) {
|
||||||
if (_inputBuffer == null || buffer.length > _inputBuffer.length) {
|
if (_inputBuffer == null || (buffer != null && buffer.length > _inputBuffer.length)) {
|
||||||
_inputBuffer = buffer;
|
_inputBuffer = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,9 +155,9 @@ public class BufferRecycler {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void releaseDecodeBuffer(byte[] buffer) {
|
public void releaseDecodeBuffer(byte[] buffer) {
|
||||||
if (_decodingBuffer == null || buffer.length > _decodingBuffer.length) {
|
if (_decodingBuffer == null || (buffer != null && buffer.length > _decodingBuffer.length)) {
|
||||||
_decodingBuffer = buffer;
|
_decodingBuffer = buffer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue