diff --git a/src/metadata.mli b/src/metadata.mli index 327478c..1f4ecdc 100644 --- a/src/metadata.mli +++ b/src/metadata.mli @@ -8,8 +8,6 @@ module Make : functor (_ : CharEncoding.T) -> sig (** Raised when the metadata is not valid. *) exception Invalid - type endianness = MetadataBase.endianness - (** Metadata are represented as association lists. *) type metadata = (string * string) list @@ -35,9 +33,10 @@ module Make : functor (_ : CharEncoding.T) -> sig type custom_parser = parser_handler -> unit + (** Abstractions for reading from various sources. *) module Reader : sig - (** A function to read taking the buffer to fill the offset and the length and - returning the number of bytes actually read. *) + (** A function to read taking the buffer to fill the offset and the length + and returning the number of bytes actually read. *) type t = MetadataBase.Reader.t = { read : bytes -> int -> int -> int; read_ba : (int -> MetadataBase.bigarray) option; @@ -50,8 +49,10 @@ module Make : functor (_ : CharEncoding.T) -> sig (** Go back at the beginning of the stream. *) val reset : t -> unit + (** Specialize a parser to operate on files. *) val with_file : ?custom_parser:custom_parser -> (t -> metadata) -> string -> metadata + (** Specialize a parser to operate on strings. *) val with_string : ?custom_parser:custom_parser -> (t -> metadata) -> string -> metadata end diff --git a/src/metadataBase.ml b/src/metadataBase.ml index 72da591..770f0ac 100644 --- a/src/metadataBase.ml +++ b/src/metadataBase.ml @@ -5,6 +5,7 @@ type bigarray = (char, Bigarray.int8_unsigned_elt, Bigarray.c_layout) Bigarray.Array1.t type metadata = (string * string) list + type endianness = Big_endian | Little_endian type parser_handler = {