class pipe :A
?conv:Netbuffer.t -> bool -> Netbuffer.t -> unit -> unit ->
pipehas two internal buffers (realized by Netbuffer). The output methods of the class write to the incoming buffer. When new data are appended to the incoming buffer, the conversion function
convis called; the arguments are the incoming buffer and the outgoing buffer. The conversion function must convert the data available in the incoming buffer and append the result to the outgoing buffer. Finally, the input methods of the class return the data found in the outgoing buffer.
The conversion function is called as follows:
conv incoming_buffer at_eof outgoing_buffer
The conversion function is allowed to do nothing if the incoming data are not complete enough to be converted. It is also allowed to convert only the beginning of the incoming buffer.
If the outgoing buffer is empty, the input methods will raise
close_out is invoked, the end of the data stream will be recorded.
In this case, the conversion function is called with
at_eof = true,
and it is expected that this function converts the whole data found
in the incoming buffer.
The conversion function may raise exceptions. The exceptions will
fall through to the caller of the input methods. (The output methods
close_out never fail because of such exceptions.)
The default conversion function copies everything from the incoming
buffer to the outgoing buffer without modification.