Module: Net::SSH::Util::ReaderBufferImpl

Module | Net::SSH::Util::ReaderBufferImpl
In: | lib/net/ssh/util/buffer.rb

A convenience module for representing a string of encoded data. It provides an interface for easily reading and decoding the buffer.

### Methods

append clear! eof? read read_bool read_byte read_int64 read_long read_short read_string remainder_as_buffer reset!

### Attributes

position | [R] | the current position of the pointer in the buffer

### Public Instance methods

append( text )

Appends the given text to the end of the buffer.

clear!()

Resets the buffer, making it empty.

eof?()

Returns true if the pointer is at the end of the buffer.

read( count = nil )

Reads `count` bytes from the buffer. If `count` is `nil`, this will return all remaining text in the buffer. This method will increment the pointer.

read_bool()

Read a single byte and convert it into a boolean, using ‘C’ rules (i.e., zero is false, non-zero is true).

read_byte()

Read and return the next byte in the buffer.

read_int64()

Return the next 8 bytes as a 64-bit integer (in network byte order).

read_long()

Return the next four bytes as a long integer (in network byte order).

read_short()

Read the next two bytes as a short integer (in network byte order).

read_string()

Read and return an SSH2-encoded string. The string starts with a long integer that describes the number of bytes remaining in the string.

remainder_as_buffer()

Returns all text from the current pointer to the end of the buffer as a new buffer as the same class as the receiver.

reset!()

Resets the pointer to the start of the buffer.

[Validate]