buffer.
private int bufferHighmark; // Index of the last four byte word in the buffer, which has been read in from the datagram socket.
private int fragmentLength; // Remaining number of bytes in this fragment -- and still to read.
private bool lastFragment; // Flag indicating that we've read the last fragment and thus reached the end of the record.
public XdrTcpDecodingStream (TcpClient client, int bufferSize)
{
// If the given buffer size is too small, start with a more sensible
// size. Next, if bufferSize is not a multiple of four, round it up to
// the next multiple of four.
//
this.client = client;
stream = client.GetStream ();
if (bufferSize < 1024)
bufferSize = 1024;
if ((bufferSize & 3) != 0 )
bufferSize = (bufferSize + 4) & ~3;
//
// Set up the buffer and the buffer pointers (no, this is still Java).
//
buffer = new byte [bufferSize];
bufferIndex = 0;
bufferHighmark = -4;
lastFragment = false;
fragmentLength = 0;
}
/// This method does not accept empty XDR record fragments with the /// only exception of a final trailing empty fragment. This special case /// is accepted as some ONC/RPC implementations emit such trailing /// empty fragments whenever the encoded data is a full multiple of their /// internal record buffer size. ///
offset with a
/// length of length. Only the opaque value is decoded, so the
/// caller has to know how long the opaque value will be. The decoded data
/// is always padded to be a multiple of four (because that's what the
/// sender does).
///