From: Bryan Duxbury Date: Wed, 4 Nov 2009 00:30:10 +0000 (+0000) Subject: THRIFT-620. java: Compact Protocol should call readAll, not read X-Git-Tag: 0.2.0~15 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=6731b57b582badaa3fca91e6ac54bf18cd2cf0f7;p=common%2Fthrift.git THRIFT-620. java: Compact Protocol should call readAll, not read This patch switches to calling readAll instead of read. git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@832633 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java b/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java index e2d0bfdc..79f2f4aa 100755 --- a/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java +++ b/lib/java/src/org/apache/thrift/protocol/TCompactProtocol.java @@ -554,7 +554,7 @@ public final class TCompactProtocol extends TProtocol { * Read a single byte off the wire. Nothing interesting here. */ public byte readByte() throws TException { - trans_.read(byteRawBuf, 0, 1); + trans_.readAll(byteRawBuf, 0, 1); return byteRawBuf[0]; } @@ -584,7 +584,7 @@ public final class TCompactProtocol extends TProtocol { */ public double readDouble() throws TException { byte[] longBits = new byte[8]; - trans_.read(longBits, 0, 8); + trans_.readAll(longBits, 0, 8); return Double.longBitsToDouble(bytesToLong(longBits)); } @@ -607,7 +607,7 @@ public final class TCompactProtocol extends TProtocol { if (length == 0) return new byte[0]; byte[] buf = new byte[length]; - trans_.read(buf, 0, length); + trans_.readAll(buf, 0, length); return buf; }