package capnp

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type t

The type of streams containing framed messages.

val empty : compression_t -> t

empty compression returns a new stream for decoding data stored with the given compression method. The stream initially contains no data.

val of_string : compression:compression_t -> string -> t

of_string ~compression buf returns a new stream which is filled with the contents of the given buffer, where the buffer contains data compressed with the specified compression method.

val add_fragment : t -> string -> unit

add_fragment stream fragment adds a new fragment to the stream for decoding. Fragments are processed in FIFO order.

val bytes_available : t -> int

bytes_available stream obtains the number of bytes in the stream which have not yet been fully decoded.

val is_empty : t -> bool

is_empty stream determines whether or not the stream contains any data which has not yet been fully decoded.

get_next_frame attempts to decode the next frame from the stream. A successful decode removes the data from the stream and returns the frame data in the form of a BytesMessage.