Repository: thrift Updated Branches: refs/heads/master 6e25d749b -> 57e68b250
THRIFT-2643 Introduce additional deserialize() variant with offset/length Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/57e68b25 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/57e68b25 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/57e68b25 Branch: refs/heads/master Commit: 57e68b2500ca941e313651370ac4d52139a060eb Parents: 6e25d74 Author: Charles O'Farrell <charl...@charleso.org> Authored: Fri Aug 1 18:02:36 2014 +1000 Committer: Charles O'Farrell <charl...@charleso.org> Committed: Fri Aug 1 18:09:38 2014 +1000 ---------------------------------------------------------------------- lib/java/src/org/apache/thrift/TDeserializer.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/57e68b25/lib/java/src/org/apache/thrift/TDeserializer.java ---------------------------------------------------------------------- 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 @@ public class TDeserializer { * @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();