Pike v8.0 release 1738

Method Stdio.Buffer()->read_hbuffer()


Method read_hbuffer

Buffer read_hbuffer(int n)
Buffer read_hbuffer(int n, bool copy)

Description

Same as read_hstring, but returns the result as an Buffer.

No data is copied unless copy is specified and true, the new buffer points into the old one.

Note

As long as the subbuffer exists no data can be added to the main buffer.

Usually this is OK, since it often represents something that should be parsed before the next whatever is extracted from the buffer, but do take care.

If you need to unlink the new buffer after it has been created, call trim in it.