summaryrefslogtreecommitdiff
path: root/csharp/src/Ice/StreamWrapper.cs
diff options
context:
space:
mode:
Diffstat (limited to 'csharp/src/Ice/StreamWrapper.cs')
-rw-r--r--csharp/src/Ice/StreamWrapper.cs136
1 files changed, 68 insertions, 68 deletions
diff --git a/csharp/src/Ice/StreamWrapper.cs b/csharp/src/Ice/StreamWrapper.cs
index 983182a9ff6..b41cb8a560a 100644
--- a/csharp/src/Ice/StreamWrapper.cs
+++ b/csharp/src/Ice/StreamWrapper.cs
@@ -25,24 +25,24 @@ namespace IceInternal
// Slice sequences are encoded on the wire as a count of elements, followed
// by the sequence contents. For arbitrary .NET classes, we do not know how
// big the sequence that is eventually written will be. To avoid excessive
- // data copying, this class maintains a private bytes_ array of 254 bytes and,
+ // data copying, this class maintains a private _bytes array of 254 bytes and,
// initially, writes data into that array. If more than 254 bytes end up being
// written, we write a dummy sequence size of 255 (which occupies five bytes
// on the wire) into the stream and, once this class is disposed, patch
- // that size to match the actual size. Otherwise, if the bytes_ buffer contains
+ // that size to match the actual size. Otherwise, if the _bytes buffer contains
// fewer than 255 bytes when this class is disposed, we write the sequence size
- // as a single byte, followed by the contents of the bytes_ buffer.
+ // as a single byte, followed by the contents of the _bytes buffer.
//
public class OutputStreamWrapper : System.IO.Stream, System.IDisposable
{
public OutputStreamWrapper(Ice.OutputStream s)
{
- s_ = s;
- spos_ = s.pos();
- bytes_ = new byte[254];
- pos_ = 0;
- length_ = 0;
+ _s = s;
+ _spos = s.pos();
+ _bytes = new byte[254];
+ _pos = 0;
+ _length = 0;
}
public override int Read(byte[] buffer, int offset, int count)
@@ -62,38 +62,38 @@ namespace IceInternal
Debug.Assert(array != null && offset >= 0 && count >= 0 && offset + count <= array.Length);
try
{
- if(bytes_ != null)
+ if(_bytes != null)
{
//
- // If we can fit the data into the first 254 bytes, write it to bytes_.
+ // If we can fit the data into the first 254 bytes, write it to _bytes.
//
- if(count <= bytes_.Length - pos_)
+ if(count <= _bytes.Length - _pos)
{
- System.Buffer.BlockCopy(array, offset, bytes_, pos_, count);
- pos_ += count;
+ System.Buffer.BlockCopy(array, offset, _bytes, _pos, count);
+ _pos += count;
return;
}
- s_.writeSize(255); // Dummy size, until we know how big the stream
+ _s.writeSize(255); // Dummy size, until we know how big the stream
// really is and can patch the size.
- if(pos_ > 0)
+ if(_pos > 0)
{
//
- // Write the current contents of bytes_.
+ // Write the current contents of _bytes.
//
- s_.expand(pos_);
- s_.getBuffer().b.put(bytes_, 0, pos_);
+ _s.expand(_pos);
+ _s.getBuffer().b.put(_bytes, 0, _pos);
}
- bytes_ = null;
+ _bytes = null;
}
//
// Write data passed by caller.
//
- s_.expand(count);
- s_.getBuffer().b.put(array, offset, count);
- pos_ += count;
+ _s.expand(count);
+ _s.getBuffer().b.put(array, offset, count);
+ _pos += count;
}
catch(System.Exception ex)
{
@@ -105,37 +105,37 @@ namespace IceInternal
{
try
{
- if(bytes_ != null)
+ if(_bytes != null)
{
//
- // If we can fit the data into the first 254 bytes, write it to bytes_.
+ // If we can fit the data into the first 254 bytes, write it to _bytes.
//
- if(pos_ < bytes_.Length)
+ if(_pos < _bytes.Length)
{
- bytes_[pos_++] = value;
+ _bytes[_pos++] = value;
return;
}
- s_.writeSize(255); // Dummy size, until we know how big the stream
+ _s.writeSize(255); // Dummy size, until we know how big the stream
// really is and can patch the size.
- if(pos_ > 0)
+ if(_pos > 0)
{
//
- // Write the current contents of bytes_.
+ // Write the current contents of _bytes.
//
- s_.expand(pos_);
- s_.getBuffer().b.put(bytes_, 0, pos_);
+ _s.expand(_pos);
+ _s.getBuffer().b.put(_bytes, 0, _pos);
}
- bytes_ = null;
+ _bytes = null;
}
//
// Write data passed by caller.
//
- s_.expand(1);
- s_.getBuffer().b.put(value);
- pos_ += 1;
+ _s.expand(1);
+ _s.getBuffer().b.put(value);
+ _pos += 1;
}
catch(System.Exception ex)
{
@@ -171,20 +171,20 @@ namespace IceInternal
{
try
{
- if(bytes_ != null)
+ if(_bytes != null)
{
- Debug.Assert(pos_ <= bytes_.Length);
- s_.pos(spos_);
- s_.writeSize(pos_);
- s_.expand(pos_);
- s_.getBuffer().b.put(bytes_, 0, pos_);
+ Debug.Assert(_pos <= _bytes.Length);
+ _s.pos(_spos);
+ _s.writeSize(_pos);
+ _s.expand(_pos);
+ _s.getBuffer().b.put(_bytes, 0, _pos);
}
else
{
- int currentPos = s_.pos();
- s_.pos(spos_);
- s_.writeSize(pos_); // Patch previously-written dummy value.
- s_.pos(currentPos);
+ int currentPos = _s.pos();
+ _s.pos(_spos);
+ _s.writeSize(_pos); // Patch previously-written dummy value.
+ _s.pos(currentPos);
}
}
catch(System.Exception ex)
@@ -197,7 +197,7 @@ namespace IceInternal
{
get
{
- return length_;
+ return _length;
}
}
@@ -205,7 +205,7 @@ namespace IceInternal
{
get
{
- return pos_;
+ return _pos;
}
set
@@ -223,23 +223,23 @@ namespace IceInternal
public override void SetLength(long value)
{
Debug.Assert(value >= 0);
- length_ = value;
+ _length = value;
}
- private Ice.OutputStream s_;
- private int spos_;
- private byte[] bytes_;
- private int pos_;
- private long length_;
+ private Ice.OutputStream _s;
+ private int _spos;
+ private byte[] _bytes;
+ private int _pos;
+ private long _length;
}
public class InputStreamWrapper : System.IO.Stream, System.IDisposable
{
public InputStreamWrapper(int size, Ice.InputStream s)
{
- s_ = s;
- pos_ = 0;
- length_ = size;
+ _s = s;
+ _pos = 0;
+ _length = size;
}
public override int Read(byte[] buffer, int offset, int count)
@@ -247,7 +247,7 @@ namespace IceInternal
Debug.Assert(buffer != null && offset >= 0 && count >= 0 && offset + count <= buffer.Length);
try
{
- s_.getBuffer().b.get(buffer, offset, count);
+ _s.getBuffer().b.get(buffer, offset, count);
}
catch(System.Exception ex)
{
@@ -260,7 +260,7 @@ namespace IceInternal
{
try
{
- return s_.getBuffer().b.get();
+ return _s.getBuffer().b.get();
}
catch(System.Exception ex)
{
@@ -321,7 +321,7 @@ namespace IceInternal
{
get
{
- return length_;
+ return _length;
}
}
@@ -329,7 +329,7 @@ namespace IceInternal
{
get
{
- return pos_;
+ return _pos;
}
set
@@ -345,17 +345,17 @@ namespace IceInternal
{
case SeekOrigin.Begin:
{
- pos_ = (int)offset;
+ _pos = (int)offset;
break;
}
case SeekOrigin.Current:
{
- pos_ += (int)offset;
+ _pos += (int)offset;
break;
}
case SeekOrigin.End:
{
- pos_ = (int)length_ + (int)offset;
+ _pos = (int)_length + (int)offset;
break;
}
default:
@@ -364,8 +364,8 @@ namespace IceInternal
break;
}
}
- s_.pos(pos_);
- return pos_;
+ _s.pos(_pos);
+ return _pos;
}
public override void SetLength(long value)
@@ -373,8 +373,8 @@ namespace IceInternal
Debug.Assert(false);
}
- private Ice.InputStream s_;
- private int pos_;
- private long length_;
+ private Ice.InputStream _s;
+ private int _pos;
+ private long _length;
}
}