package gapi-ocaml

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

This is the read-only version of a MIME body. There are only methods * to read the body contents. * * The value of the body can be returned either as string, or as * object channel. Both ways are possible independently of where * the value is stored, in-memory, or as external file.

method value : string

The value method returns the _decoded_ body, * i.e. transfer encodings are removed before the value is passed * back. * * When the body is stored in an external file, this method * reads the complete file into memory.

method store : store

Where the body is actually stored.

method open_value_rd : unit -> Netchannels.in_obj_channel

Opens the value for reading. This works independently of where * the body is stored. For example, to read the body line by line: *

* let ch = body # open_value_rd () in
* try
*   while true do
*     let line = ch # input_line() in
*     ... (* do something *)
*   done;
*   assert false; (* never reached *)
* with
*   End_of_file ->
*     ch # close_in()
* 

* * As value, this method returns the value in decoded form. * This method is quite economical with the resources, and takes * only as much memory as needed for the channel operations.

method finalize : unit -> unit

After the body has been finalized, it cannot be accessed any longer. * External resources (files) are deallocated, if they are seen as * temporary.

OCaml

Innovation. Community. Security.