Class SshData
- Namespace
- Renci.SshNet.Common
- Assembly
- Renci.SshNet.dll
Base ssh data serialization type.
public abstract class SshDataInheritance
Derived
Inherited Members
Properties
BufferCapacity
Gets the size of the message in bytes.
protected virtual int BufferCapacity { get; }Property Value
DataStream
Gets the underlying Renci.SshNet.Common.SshDataStream that is used for reading and writing SSH data.
protected SshDataStream DataStream { get; }Property Value
IsEndOfData
Gets a value indicating whether all data from the buffer has been read.
protected bool IsEndOfData { get; }Property Value
Methods
GetBytes()
Gets data bytes array.
public byte[] GetBytes()Returns
- byte[]
-
A System.Byte array representation of data structure.
Load(byte[])
Loads data from specified bytes.
public void Load(byte[] data)Parameters
databyte[]-
Bytes array.
Exceptions
- ArgumentNullException
-
datais null.
Load(byte[], int, int)
Loads data from the specified buffer.
public void Load(byte[] data, int offset, int count)Parameters
databyte[]-
Bytes array.
offsetint-
The zero-based offset in
dataat which to begin reading SSH data. countint-
The number of bytes to load.
Exceptions
- ArgumentNullException
-
datais null.
LoadData()
Called when type specific data need to be loaded.
protected abstract void LoadData()ReadBinary()
Reads next data type as byte array from internal buffer.
protected byte[] ReadBinary()Returns
- byte[]
-
The bytes read.
ReadBoolean()
Reads the next System.Boolean from the internal buffer.
protected bool ReadBoolean()Returns
- bool
-
The System.Boolean that was read.
Exceptions
- InvalidOperationException
-
Attempt to read past the end of the stream.
ReadByte()
Reads next byte data type from internal buffer.
protected byte ReadByte()Returns
- byte
-
The System.Byte read.
Exceptions
- InvalidOperationException
-
Attempt to read past the end of the stream.
ReadBytes()
Reads all data left in internal buffer at current position.
protected byte[] ReadBytes()Returns
- byte[]
-
An array of bytes containing the remaining data in the internal buffer.
ReadBytes(int)
Reads next specified number of bytes data type from internal buffer.
protected byte[] ReadBytes(int length)Parameters
lengthint-
Number of bytes to read.
Returns
- byte[]
-
An array of bytes that was read from the internal buffer.
Exceptions
- ArgumentOutOfRangeException
-
lengthis greater than the number of bytes available to be read.
ReadExtensionPair()
Reads next extension-pair data type from internal buffer.
protected Dictionary<string, string> ReadExtensionPair()Returns
- Dictionary<string, string>
-
Extensions pair dictionary.
ReadNamesList()
Reads next name-list data type from internal buffer.
protected string[] ReadNamesList()Returns
- string[]
-
String array or read data.
ReadString(Encoding)
Reads the next System.String from the internal buffer using the specified encoding.
protected string ReadString(Encoding encoding = null)Parameters
encodingEncoding-
The character encoding to use.
Returns
- string
-
The System.String that was read.
ReadUInt16()
Reads the next System.UInt16 from the internal buffer.
protected ushort ReadUInt16()Returns
- ushort
-
The System.UInt16 that was read.
Exceptions
- InvalidOperationException
-
Attempt to read past the end of the stream.
ReadUInt32()
Reads the next System.UInt32 from the internal buffer.
protected uint ReadUInt32()Returns
- uint
-
The System.UInt32 that was read.
Exceptions
- InvalidOperationException
-
Attempt to read past the end of the stream.
ReadUInt64()
Reads the next System.UInt64 from the internal buffer.
protected ulong ReadUInt64()Returns
- ulong
-
The System.UInt64 that was read.
Exceptions
- InvalidOperationException
-
Attempt to read past the end of the stream.
SaveData()
Called when type specific data need to be saved.
protected abstract void SaveData()Write(byte[])
Writes bytes array data into internal buffer.
protected void Write(byte[] data)Parameters
databyte[]-
Byte array data to write.
Exceptions
- ArgumentNullException
-
datais null.
Write(byte[], int, int)
Writes a sequence of bytes to the current SSH data stream and advances the current position within this stream by the number of bytes written.
protected void Write(byte[] buffer, int offset, int count)Parameters
bufferbyte[]-
An array of bytes. This method write
countbytes from buffer to the current SSH data stream. offsetint-
The zero-based offset in
bufferat which to begin writing bytes to the SSH data stream. countint-
The number of bytes to be written to the current SSH data stream.
Exceptions
- ArgumentNullException
-
bufferis null. - ArgumentException
-
The sum of
offsetandcountis greater than the buffer length. - ArgumentOutOfRangeException
-
offsetorcountis negative.
Write(byte)
Writes System.Byte data into internal buffer.
protected void Write(byte data)Parameters
databyte-
System.Byte data to write.
Write(bool)
Writes System.Boolean into internal buffer.
protected void Write(bool data)Parameters
databool-
System.Boolean data to write.
Write(uint)
Writes System.UInt32 data into internal buffer.
protected void Write(uint data)Parameters
datauint-
System.UInt32 data to write.
Write(ulong)
Writes System.UInt64 data into internal buffer.
protected void Write(ulong data)Parameters
dataulong-
System.UInt64 data to write.
Write(string)
Writes System.String data into internal buffer using default encoding.
protected void Write(string data)Parameters
datastring-
System.String data to write.
Exceptions
- ArgumentNullException
-
datais null.
Write(string, Encoding)
Writes System.String data into internal buffer using the specified encoding.
protected void Write(string data, Encoding encoding)Parameters
Exceptions
- ArgumentNullException
-
datais null. - ArgumentNullException
-
encodingis null.
Write(BigInteger)
Writes mpint data into internal buffer.
protected void Write(BigInteger data)Parameters
dataBigInteger-
mpint data to write.
Write(string[])
Writes name-list data into internal buffer.
protected void Write(string[] data)Parameters
datastring[]-
name-list data to write.
Write(IDictionary<string, string>)
Writes extension-pair data into internal buffer.
protected void Write(IDictionary<string, string> data)Parameters
dataIDictionary<string, string>-
extension-pair data to write.
WriteBinary(byte[], int, int)
Writes data into internal buffer.
protected void WriteBinary(byte[] buffer, int offset, int count)Parameters
bufferbyte[]-
An array of bytes. This method write
countbytes from buffer to the current SSH data stream. offsetint-
The zero-based byte offset in
bufferat which to begin writing bytes to the SSH data stream. countint-
The number of bytes to be written to the current SSH data stream.
Exceptions
- ArgumentNullException
-
bufferis null. - ArgumentException
-
The sum of
offsetandcountis greater than the buffer length. - ArgumentOutOfRangeException
-
offsetorcountis negative.
WriteBinaryString(byte[])
Writes data into internal buffer.
protected void WriteBinaryString(byte[] buffer)Parameters
bufferbyte[]-
The data to write.
Exceptions
- ArgumentNullException
-
bufferis null.
WriteBytes(SshDataStream)
Writes the current message to the specified Renci.SshNet.Common.SshDataStream.
protected virtual void WriteBytes(SshDataStream stream)Parameters
streamSshDataStream-
The Renci.SshNet.Common.SshDataStream to write the message to.