C# Класс Renci.SshNet.Sftp.SftpFileStream

Exposes a System.IO.Stream around a remote SFTP file, supporting both synchronous and asynchronous read and write operations.
Наследование: Stream
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
CheckSessionIsOpen void
FlushReadBuffer void
FlushWriteBuffer void
SetupRead void
SetupWrite void
SftpFileStream System
SftpFileStream System

Открытые методы

Метод Описание
Flush ( ) : void

Clears all buffers for this stream and causes any buffered data to be written to the file.

Read ( byte buffer, int offset, int count ) : int

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.

ReadByte ( ) : int

Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.

Seek ( long offset, SeekOrigin origin ) : long

Sets the position within the current stream.

SetLength ( long value ) : void

When overridden in a derived class, sets the length of the current stream.

Write ( byte buffer, int offset, int count ) : void

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.

WriteByte ( byte value ) : void

Writes a byte to the current position in the stream and advances the position within the stream by one byte.

Защищенные методы

Метод Описание
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the managed resources.

Приватные методы

Метод Описание
CheckSessionIsOpen ( ) : void
FlushReadBuffer ( ) : void

Flushes the read data from the buffer.

FlushWriteBuffer ( ) : void

Flush any buffered write data to the file.

SetupRead ( ) : void

Setups the read.

SetupWrite ( ) : void

Setups the write.

SftpFileStream ( ISftpSession session, string path, FileMode mode, FileAccess access, int bufferSize ) : System
SftpFileStream ( ISftpSession session, string path, FileMode mode, FileAccess access, int bufferSize, bool useAsync ) : System

Описание методов

Dispose() защищенный Метод

Releases the unmanaged resources used by the T:System.IO.Stream and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; false to release only unmanaged resources.
Результат void

Flush() публичный Метод

Clears all buffers for this stream and causes any buffered data to be written to the file.
An I/O error occurs. Stream is closed.
public Flush ( ) : void
Результат void

Read() публичный Метод

Reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
The sum of and is larger than the buffer length. is null. or is negative. An I/O error occurs. The stream does not support reading. Methods were called after the stream was closed.
public Read ( byte buffer, int offset, int count ) : int
buffer byte An array of bytes. When this method returns, the buffer contains the specified byte array with the values between and ( + - 1) replaced by the bytes read from the current source.
offset int The zero-based byte offset in at which to begin storing the data read from the current stream.
count int The maximum number of bytes to be read from the current stream.
Результат int

ReadByte() публичный Метод

Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.
The stream does not support reading. Methods were called after the stream was closed. Read operation failed.
public ReadByte ( ) : int
Результат int

Seek() публичный Метод

Sets the position within the current stream.
An I/O error occurs. The stream does not support seeking, such as if the stream is constructed from a pipe or console output. Methods were called after the stream was closed.
public Seek ( long offset, SeekOrigin origin ) : long
offset long A byte offset relative to the parameter.
origin SeekOrigin A value of type indicating the reference point used to obtain the new position.
Результат long

SetLength() публичный Метод

When overridden in a derived class, sets the length of the current stream.
An I/O error occurs. The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. Methods were called after the stream was closed. must be greater than zero.
public SetLength ( long value ) : void
value long The desired length of the current stream in bytes.
Результат void

Write() публичный Метод

Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
The sum of and is greater than the buffer length. is null. or is negative. An I/O error occurs. The stream does not support writing. Methods were called after the stream was closed.
public Write ( byte buffer, int offset, int count ) : void
buffer byte An array of bytes. This method copies bytes from to the current stream.
offset int The zero-based byte offset in at which to begin copying bytes to the current stream.
count int The number of bytes to be written to the current stream.
Результат void

WriteByte() публичный Метод

Writes a byte to the current position in the stream and advances the position within the stream by one byte.
An I/O error occurs. The stream does not support writing, or the stream is already closed. Methods were called after the stream was closed.
public WriteByte ( byte value ) : void
value byte The byte to write to the stream.
Результат void