Bufferrecord
A mutable FIFO byte sequence.
Members
| Name | Kind | Description |
|---|
__len | metamethod | Returns the unread byte count without consuming data. |
__concat | metamethod | Concatenates the buffer's unread text with another value. |
__tostring | metamethod | Returns unread bytes without consuming them. |
put | method | Appends each value and returns a borrow of this same buffer for chaining. |
putf | method | Formats and appends text, returning the same borrowed buffer. |
get | method | Consumes successive requested byte counts and returns one string per count. |
tostring | method | Copies unread bytes into a string without advancing the FIFO. |
reset | method | Discards buffered bytes and returns the same reusable buffer. |
free | method | Releases retained storage and returns the same reusable buffer. |
skip | method | Discards a prefix of unread bytes and returns the same borrowed buffer. |
set | method | Replaces unread contents with bytes and returns the same borrowed buffer. |
__lenmetamethod
__len: function(self): integer
Returns the unread byte count without consuming data.
Arguments
Returns
__concatmetamethod
__concat: function(self, other: any): string
Concatenates the buffer's unread text with another value.
Arguments
| Name | Type | Description |
|---|
? | self | |
other | any | |
Returns
__tostringmetamethod
__tostring: function(self): string
Returns unread bytes without consuming them.
Arguments
Returns
putmethod
put: function(exclusive b: Buffer, ...: any): Buffer borrows (b)
Appends each value and returns a borrow of this same buffer for chaining.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
... | any | |
Returns
| Type | Description |
|---|
Buffer borrows (b) | |
putfmethod
putf: function(exclusive b: Buffer, fmt: string, ...: any): Buffer borrows (b)
Formats and appends text, returning the same borrowed buffer.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
fmt | string | |
... | any | |
Returns
| Type | Description |
|---|
Buffer borrows (b) | |
getmethod
get: function(exclusive b: Buffer, ...: integer?): (string,...string)
Consumes successive requested byte counts and returns one string per count. With no count, consumes all unread bytes. Counts are taken in order, so when one is negative or fractional and raises, the reads before it have already consumed their bytes.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
... | integer? | |
Returns
tostringmethod
tostring: function(b: Buffer): string
Copies unread bytes into a string without advancing the FIFO.
Arguments
Returns
resetmethod
Discards buffered bytes and returns the same reusable buffer.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
Returns
| Type | Description |
|---|
Buffer borrows (b) | |
freemethod
Releases retained storage and returns the same reusable buffer.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
Returns
| Type | Description |
|---|
Buffer borrows (b) | |
skipmethod
Discards a prefix of unread bytes and returns the same borrowed buffer.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
count | integer | |
Returns
| Type | Description |
|---|
Buffer borrows (b) | |
setmethod
set: function(exclusive b: Buffer, bytes: string): Buffer borrows (b)
Replaces unread contents with bytes and returns the same borrowed buffer.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
bytes | string | |
Returns
| Type | Description |
|---|
Buffer borrows (b) | |