Author: dreiss
Date: Mon Apr 26 19:37:53 2010
New Revision: 938206

URL: http://svn.apache.org/viewvc?rev=938206&view=rev
Log:
THRFIT-601. java: Add readLength support to TBinaryProtocol.Factory

Modified:
    
incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java

Modified: 
incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
URL: 
http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java?rev=938206&r1=938205&r2=938206&view=diff
==============================================================================
--- 
incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
 (original)
+++ 
incubator/thrift/trunk/lib/java/src/org/apache/thrift/protocol/TBinaryProtocol.java
 Mon Apr 26 19:37:53 2010
@@ -45,18 +45,28 @@ public class TBinaryProtocol extends TPr
   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;
     }
   }
 


Reply via email to