diff options
author | Jon Skeet <jonskeet@google.com> | 2015-08-03 11:08:53 +0100 |
---|---|---|
committer | Jon Skeet <jonskeet@google.com> | 2015-08-03 11:30:15 +0100 |
commit | 0e0e0c97e7d5a70b3307c2fcea8793983b6e0680 (patch) | |
tree | 00f2d3938d3efd08057024143a7afea36786a008 /csharp/src/Google.Protobuf/CodedInputStream.cs | |
parent | bf1cc9217a486cf68c2705d4f307fddb73291004 (diff) | |
download | protobuf-0e0e0c97e7d5a70b3307c2fcea8793983b6e0680.tar.gz protobuf-0e0e0c97e7d5a70b3307c2fcea8793983b6e0680.tar.bz2 protobuf-0e0e0c97e7d5a70b3307c2fcea8793983b6e0680.zip |
Expose Coded*Stream constructors directly.
Diffstat (limited to 'csharp/src/Google.Protobuf/CodedInputStream.cs')
-rw-r--r-- | csharp/src/Google.Protobuf/CodedInputStream.cs | 39 |
1 files changed, 11 insertions, 28 deletions
diff --git a/csharp/src/Google.Protobuf/CodedInputStream.cs b/csharp/src/Google.Protobuf/CodedInputStream.cs index ef7cf114..f2e1d661 100644 --- a/csharp/src/Google.Protobuf/CodedInputStream.cs +++ b/csharp/src/Google.Protobuf/CodedInputStream.cs @@ -93,43 +93,19 @@ namespace Google.Protobuf private int sizeLimit = DefaultSizeLimit;
#region Construction
-
- /// <summary>
- /// Creates a new CodedInputStream reading data from the given
- /// stream.
- /// </summary>
- public static CodedInputStream CreateInstance(Stream input)
- {
- return new CodedInputStream(input);
- }
- /// <summary>
- /// Creates a new CodedInputStream reading data from the given
- /// stream and a pre-allocated memory buffer.
- /// </summary>
- public static CodedInputStream CreateInstance(Stream input, byte[] buffer)
- {
- return new CodedInputStream(input, buffer);
- }
-
/// <summary>
/// Creates a new CodedInputStream reading data from the given
/// byte array.
/// </summary>
- public static CodedInputStream CreateInstance(byte[] buf)
+ public CodedInputStream(byte[] buf) : this(buf, 0, buf.Length)
{
- return new CodedInputStream(buf, 0, buf.Length);
}
/// <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)
+ public CodedInputStream(byte[] buffer, int offset, int length)
{
this.buffer = buffer;
this.bufferPos = offset;
@@ -137,14 +113,21 @@ namespace Google.Protobuf this.input = null;
}
- private CodedInputStream(Stream input)
+ /// <summary>
+ /// Creates a new CodedInputStream reading data from the given stream.
+ /// </summary>
+ public CodedInputStream(Stream input)
{
this.buffer = new byte[BufferSize];
this.bufferSize = 0;
this.input = input;
}
- private CodedInputStream(Stream input, byte[] buffer)
+ /// <summary>
+ /// Creates a new CodedInputStream reading data from the given
+ /// stream, with a pre-allocated buffer.
+ /// </summary>
+ internal CodedInputStream(Stream input, byte[] buffer)
{
this.buffer = buffer;
this.bufferSize = 0;
|