Bufferrecord
A mutable FIFO byte sequence shared by all portable buffer providers.
Providers return this one nominal declaration rather than defining their own Buffer type. Mutating methods require exclusive access; chaining returns a borrow of the same buffer and must not create another owner. Strings copied out of a buffer are independent of its subsequent mutation or release.
This portable contract contains FIFO and formatting operations. Native pointer access and host serialization belong to the native string.buffer surface.
Methods
__len
__len: function(self): integer
Returns the unread byte count without consuming data.
Arguments
Returns
__concat
__concat: function(self, other: any): string
Concatenates the buffer's unread text with another value.
Arguments
| Name | Type | Description |
|---|
? | self | |
other | any | |
Returns
__tostring
__tostring: function(self): string
Returns unread bytes without consuming them.
Arguments
Returns
put
Appends each value and returns a borrow of this same buffer for chaining.
Arguments
Returns
| Type | Description |
|---|
Buffer borrows (b) | |
putf
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) | |
get
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.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
... | integer? | |
Returns
tostring
tostring: function(b: Buffer): string
Copies unread bytes into a string without advancing the FIFO.
Arguments
Returns
reset
Discards buffered bytes and returns the same reusable buffer.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
Returns
| Type | Description |
|---|
Buffer borrows (b) | |
free
Releases retained storage and returns the same reusable buffer.
Arguments
| Name | Type | Description |
|---|
exclusive b | Buffer | |
Returns
| Type | Description |
|---|
Buffer borrows (b) | |
skip
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) | |
set
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) | |