aboutsummaryrefslogtreecommitdiffhomepage
path: root/java
diff options
context:
space:
mode:
authorGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-22 19:35:07 +0000
committerGravatar kenton@google.com <kenton@google.com@630680e5-0e50-0410-840e-4b1c322b438d>2009-12-22 19:35:07 +0000
commit28e46df3e9ae576bbde956927eba6332acf90cdf (patch)
tree7bfa862ff5f0d0b43bdb2e1eb682499aff631adc /java
parent6f12e3e29a2f75af03c27723810e5a94b56a8642 (diff)
Clarify that pushLimit() does not limit the number of bytes CodedInputStream will read from the underlying InputStream.
Diffstat (limited to 'java')
-rw-r--r--java/src/main/java/com/google/protobuf/CodedInputStream.java8
1 files changed, 8 insertions, 0 deletions
diff --git a/java/src/main/java/com/google/protobuf/CodedInputStream.java b/java/src/main/java/com/google/protobuf/CodedInputStream.java
index f0c1051d..ad43f96d 100644
--- a/java/src/main/java/com/google/protobuf/CodedInputStream.java
+++ b/java/src/main/java/com/google/protobuf/CodedInputStream.java
@@ -576,6 +576,14 @@ public final class CodedInputStream {
* Sets {@code currentLimit} to (current position) + {@code byteLimit}. This
* is called when descending into a length-delimited embedded message.
*
+ * <p>Note that {@code pushLimit()} does NOT affect how many bytes the
+ * {@code CodedInputStream} reads from an underlying {@code InputStream} when
+ * refreshing its buffer. If you need to prevent reading past a certain
+ * point in the underlying {@code InputStream} (e.g. because you expect it to
+ * contain more data after the end of the message which you need to handle
+ * differently) then you must place a wrapper around you {@code InputStream}
+ * which limits the amount of data that can be read from it.
+ *
* @return the old limit.
*/
public int pushLimit(int byteLimit) throws InvalidProtocolBufferException {