Skip to content

Commit

Permalink
THRFIT-601. java: Add readLength support to TBinaryProtocol.Factory
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.apache.org/repos/asf/incubator/thrift/trunk@938206 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
dreiss committed Apr 26, 2010
1 parent ed263a8 commit 4167ed0
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,28 @@ public class TBinaryProtocol extends TProtocol {
public static class Factory implements TProtocolFactory {
protected boolean strictRead_ = false;
protected boolean strictWrite_ = true;
protected int readLength_;

public Factory() {
this(false, true);
}

public Factory(boolean strictRead, boolean strictWrite) {
this(strictRead, strictWrite, 0);
}

public Factory(boolean strictRead, boolean strictWrite, int readLength) {
strictRead_ = strictRead;
strictWrite_ = strictWrite;
readLength_ = readLength;
}

public TProtocol getProtocol(TTransport trans) {
return new TBinaryProtocol(trans, strictRead_, strictWrite_);
TBinaryProtocol proto = new TBinaryProtocol(trans, strictRead_, strictWrite_);
if (readLength_ != 0) {
proto.setReadLength(readLength_);
}
return proto;
}
}

Expand Down

0 comments on commit 4167ed0

Please sign in to comment.