package gapi-ocaml
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=b84b680528a5e050014103a8e7a60a5d43efd5fefc3f838310bd46769775ab48
md5=8ee26acf1f6c6f5e24c7b57fa070a0a2
doc/gapi-ocaml.netstring-local/Netstream/class-sub_stream/index.html
Class Netstream.sub_stream
Source
A sub stream is the part of the whole stream from the current position * to an arbitrary other position that is determined by len
and * delimiter
. len
specifies the maximum length of the sub stream. * delimiter
is an arbitrary string that indicates the end of the * sub stream (the delimiter is not part of the sub stream; i.e. the * sub stream ends immediately before the delimiter). * * While reading from the sub stream, not only the current position of * the sub stream moves, but also the current position of the main * stream. This means that it must be avoided to read data from the * main stream while the sub stream is in use. The typical pattern * is: * - Read from the main stream until the beginning of a section is * recognized * - Create a sub stream at this point * - Read from the sub stream until EOF * - Continue reading the main stream. The next character of the main * stream is exactly the character following the EOF of the sub stream
inherit Netchannels.in_obj_channel
The normal input operations work as usual. The window is moved after * every read sequence of bytes by exactly the number of bytes, and * if the window length becomes smaller than the block size, it will * be ensured that the window will be enlarged to the block size (or * to the rest of the stream until EOF, whatever is smaller).
method window : Netbuffer.t
The look-ahead window. The first byte of the window is the byte that * would be read next by input_char
. The length of the window is returned * by the method window_length
. This length may be smaller than the * current length of the netbuffer, i.e. the netbuffer may contain * additional data that must be ignored.
Increases the length of the window such that the length is at least * the passed number of bytes or that the window reaches EOF (whatever * happens first).