teensyp.buffer
A namespace of utility functions for managing ByteBuffer objects.
buffer
(buffer size)Create a ByteBuffer of the assigned size.
buffer->str
(buffer->str buf charset)Read a String from a ByteBuffer.
copy
(copy src dest)Copy the source buffer into the destination buffer, and increment the positions of both buffers. If the source buffer has more remaining than the destination, as much as possible will be copied until the destination is full. Returns the number of bytes copied.
index-of
(index-of buffer needle)Find the first index of the specified byte in a buffer, starting from the buffer’s position.
index-of-array
(index-of-array buffer needle)Find the first index of the specified array of bytes within a buffer, starting from the buffer’s position.
read-line
(read-line buffer charset)Return the next line from the buffer, or nil if the buffer has no LF. Strips ending CR and LF characters from the resulting string. If a string is returned, the buffer’s position is advanced accordingly.
str->buffer
(str->buffer s charset)Convert a String into a ByteBuffer.