aboutsummaryrefslogtreecommitdiff
path: root/src/ProtocolBuffers/CodedInputStream.cs
diff options
context:
space:
mode:
authorCharles Stanhope <charles@cstanhope.com>2010-10-19 05:37:44 -0700
committerCharles Stanhope <charles@cstanhope.com>2010-10-19 05:37:44 -0700
commitef234da0e314255e026f82e792640b8c6f7c8134 (patch)
treee0c68bdf71cb9a6ee81957f509b014da31da1430 /src/ProtocolBuffers/CodedInputStream.cs
parentd65173a9c504b2457e4d66ce9010f75b62444dcb (diff)
downloadprotobuf-ef234da0e314255e026f82e792640b8c6f7c8134.tar.gz
protobuf-ef234da0e314255e026f82e792640b8c6f7c8134.tar.bz2
protobuf-ef234da0e314255e026f82e792640b8c6f7c8134.zip
Added CodedInputStream ctor symmetrical with CodedOutputStream.
Diffstat (limited to 'src/ProtocolBuffers/CodedInputStream.cs')
-rw-r--r--src/ProtocolBuffers/CodedInputStream.cs19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ProtocolBuffers/CodedInputStream.cs b/src/ProtocolBuffers/CodedInputStream.cs
index a929df23..e20ad0bb 100644
--- a/src/ProtocolBuffers/CodedInputStream.cs
+++ b/src/ProtocolBuffers/CodedInputStream.cs
@@ -105,13 +105,22 @@ namespace Google.ProtocolBuffers {
/// byte array.
/// </summary>
public static CodedInputStream CreateInstance(byte[] buf) {
- return new CodedInputStream(buf);
+ return new CodedInputStream(buf, 0, buf.Length);
}
- private CodedInputStream(byte[] buffer) {
- this.buffer = buffer;
- this.bufferSize = buffer.Length;
- this.input = null;
+ /// <summary>
+ /// Creates a new CodedInputStream that reads from the given
+ /// byte array slice.
+ /// </summary>
+ public static CodedInputStream CreateInstance(byte[] buf, int offset, int length) {
+ return new CodedInputStream(buf, offset, length);
+ }
+
+ private CodedInputStream(byte[] buffer, int offset, int length) {
+ this.buffer = buffer;
+ this.bufferPos = offset;
+ this.bufferSize = offset + length;
+ this.input = null;
}
private CodedInputStream(Stream input) {