THRIFT-2643 Introduce additional deserialize() variant with offset/length
diff --git a/lib/java/src/org/apache/thrift/TDeserializer.java b/lib/java/src/org/apache/thrift/TDeserializer.java
index 803d9c6..bf6c97c 100644
--- a/lib/java/src/org/apache/thrift/TDeserializer.java
+++ b/lib/java/src/org/apache/thrift/TDeserializer.java
@@ -64,8 +64,20 @@
* @param bytes The array to read from
*/
public void deserialize(TBase base, byte[] bytes) throws TException {
+ deserialize(base, bytes, 0, bytes.length);
+ }
+
+ /**
+ * Deserialize the Thrift object from a byte array.
+ *
+ * @param base The object to read into
+ * @param bytes The array to read from
+ * @param offset The offset into {@code bytes}
+ * @param length The length to read from {@code bytes}
+ */
+ public void deserialize(TBase base, byte[] bytes, int offset, int length) throws TException {
try {
- trans_.reset(bytes);
+ trans_.reset(bytes, offset, length);
base.read(protocol_);
} finally {
trans_.clear();