(* $Id: seqdb_fsys_helpers.ml 16166 2008-01-17 22:59:55Z gerd $ *) open Netchannels open Seqdb_fsys_types class raw_input_channel (fsys : 'fd file_system) (fd : 'fd) = object(self) val mutable fpos = 0L method input s p l = let n = fsys # read_file fd s p fpos l in fpos <- Int64.add fpos (Int64.of_int n); if n = 0 then raise End_of_file; n method close_in() = fsys # close_file fd method pos_in = Int64.to_int fpos end class buf_input_channel fsys fd = object(self) inherit buffered_raw_in_channel (new raw_input_channel fsys fd) method input_line = self # enhanced_input_line end class input_channel fsys fd = lift_rec_in_channel (new buf_input_channel fsys fd :> rec_in_channel) class raw_output_channel (fsys : 'fd file_system) (fd : 'fd) = object(self) val mutable fpos = 0L method output s p l = fsys # write_file fd s p fpos l; fpos <- Int64.add fpos (Int64.of_int l); l method flush() = () method close_out() = fsys # close_file fd method pos_out = Int64.to_int fpos end class output_channel fsys fd = object(self) inherit buffered_raw_out_channel (new raw_output_channel fsys fd) inherit augment_raw_out_channel end