Module

ReaderBufferImpl

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

Public Attributes
position the current position of the pointer in the buffer
Public Methods
append 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 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.
Private Methods
init_ReaderBufferImpl used by derived modules and classes to perform any reader-buffer-specific initialization.
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.