Closed GoogleCodeExporter closed 8 years ago
Line 2 will return a buffer size of "bufferSize" bytes. The bufferSize value
comes
from the Compressor constructor, which is 2048 if not otherwise specified.
Please
specify a larger buffer size for your compressor.
Compressor does not currently support automatically growing the buffer size.
Let me
know if this is necessary and I will reopen this issue. If this were to be
implemented, it would work just like ObjectBuffer.
Original comment by nathan.s...@gmail.com
on 22 Apr 2010 at 8:04
The difficulty is that my code doesn't constuct or invoke the compressor
directly.
My code calls Kryo.writeClassAndObject(), which apparently constucts and
invokes a
ByteArrayCompressor within this call using the default 'bufferSize' of 2048.
Making it so that the buffer can grow like ObjectBuffer might be ultimately the
most
efficient option, I don't know how Kryo works well enough yet to say. But it
seems
to me that since the problem with the above code is such a minor thing it would
be
worth fixing this in the mean time.
Perhaps:
public void compress (ByteBuffer inputBuffer, Object object, ByteBuffer
outputBuffer) {
Context context = Kryo.getContext();
int inputLength = inputBuffer.remaining();
byte[] inputBytes = context.getBuffer(Math.max(bufferSize,inputLength)).array();
inputBuffer.get(inputBytes, 0, inputLength);
compress(inputBytes, inputLength, outputBuffer);
}
Original comment by paul.run...@gmail.com
on 22 Apr 2010 at 11:04
Kryo will never use a compressor automatically, so someone has to be setting it
up.
Ah, your proposed fix is a good improvement, thanks! In SVN r103.
Original comment by nathan.s...@gmail.com
on 23 Apr 2010 at 6:57
Original issue reported on code.google.com by
paul.run...@gmail.com
on 22 Apr 2010 at 7:45