core: remove unused code path.

writeKnownLength() is never called with compressed == true, because in
most cases it's impossible to know the size of the compressed message.
This commit is contained in:
Kun Zhang 2016-08-24 15:38:49 -07:00
parent 23652c5b03
commit 7909abf065
1 changed files with 4 additions and 4 deletions

View File

@ -146,7 +146,7 @@ public class MessageFramer {
private int writeUncompressed(InputStream message, int messageLength) throws IOException {
if (messageLength != -1) {
return writeKnownLength(message, messageLength, false);
return writeKnownLengthUncompressed(message, messageLength);
}
BufferChainOutputStream bufferChain = new BufferChainOutputStream();
int written = writeToOutputStream(message, bufferChain);
@ -177,12 +177,12 @@ public class MessageFramer {
}
/**
* Write an unserialized message with a known length.
* Write an unserialized message with a known length, uncompressed.
*/
private int writeKnownLength(InputStream message, int messageLength, boolean compressed)
private int writeKnownLengthUncompressed(InputStream message, int messageLength)
throws IOException {
ByteBuffer header = ByteBuffer.wrap(headerScratch);
header.put(compressed ? COMPRESSED : UNCOMPRESSED);
header.put(UNCOMPRESSED);
header.putInt(messageLength);
// Allocate the initial buffer chunk based on frame header + payload length.
// Note that the allocator may allocate a buffer larger or smaller than this length