X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.compressions%2Fsrc%2Forg%2Fsimantics%2Fcompressions%2Fimpl%2FDecompressingInputStream.java;h=9329d83c4328f68398cabc8418e153d802b09246;hp=8c7987177fb32145fe27d62a0c0a7585d998ab38;hb=bf5f69c1aadb4405167e5bf03c58cc83f0ef6b20;hpb=b5c834f08accf6d283d88489e89c23da2a485fe2 diff --git a/bundles/org.simantics.compressions/src/org/simantics/compressions/impl/DecompressingInputStream.java b/bundles/org.simantics.compressions/src/org/simantics/compressions/impl/DecompressingInputStream.java index 8c7987177..9329d83c4 100644 --- a/bundles/org.simantics.compressions/src/org/simantics/compressions/impl/DecompressingInputStream.java +++ b/bundles/org.simantics.compressions/src/org/simantics/compressions/impl/DecompressingInputStream.java @@ -134,16 +134,20 @@ public abstract class DecompressingInputStream extends InputStream { return true; } - private static ByteBuffer ensureBufferSize(ByteBuffer buffer, int minCapacity) { + private ByteBuffer ensureBufferSize(ByteBuffer buffer, int minCapacity) { int oldCapacity = buffer != null ? buffer.capacity() : 0; if (buffer == null || oldCapacity < minCapacity) { int newCapacity = grow(oldCapacity, minCapacity); //System.out.println("ensureBufferSize(" + oldCapacity + ", " + minCapacity + "), new capacity " + newCapacity); - buffer = ByteBuffer.allocateDirect(newCapacity); + buffer = allocateBuffer(newCapacity); } return buffer; } + protected ByteBuffer allocateBuffer(int capacity) { + return ByteBuffer.allocateDirect(capacity); + } + /** * @param oldCapacity current capacity of a buffer * @param minCapacity