
include In_channel

(*
type t = in_channel

type open_flag = Pervasives.open_flag =
    Open_rdonly
  | Open_wronly
  | Open_append
  | Open_creat
  | Open_trunc
  | Open_excl
  | Open_binary
  | Open_text
  | Open_nonblock

let stdin = stdin

let open_bin = open_in_bin

let open_text = open_in

let open_gen = open_in_gen

let read_and_close channel f =
  Stdcompat__fun.protect
    ~finally:(fun () -> close_in_noerr channel)
    (fun () -> f channel)

let with_open_bin filename f =
  read_and_close (open_bin filename) f

let with_open_text filename f =
  read_and_close (open_text filename) f

let with_open_gen flags perm filename f =
  read_and_close (open_gen flags perm filename) f

let seek = LargeFile.seek_in

let pos = LargeFile.pos_in

let length = LargeFile.in_channel_length

let close = close_in

let close_noerr = close_in_noerr

let input_char ic =
  try
    Some (input_char ic)
  with End_of_file ->
    None

let input_byte ic =
  try
    Some (input_byte ic)
  with End_of_file ->
    None

let input_line ic =
  try
    Some (input_line ic)
  with End_of_file ->
    None

let input = input

let really_input ic buf pos len =
  try
    really_input ic buf pos len;
    Some ()
  with End_of_file ->
    None

let really_input_string ic len =
  try
    Some (Stdcompat__pervasives.really_input_string ic len)
  with End_of_file ->
    None

let set_binary_mode = set_binary_mode_in

let rec add_channel_to_the_end ~chunk_size buffer channel =
  if
    try
      Stdcompat__buffer.add_channel buffer channel chunk_size;
      true
    with End_of_file ->
      false
  then
    add_channel_to_the_end ~chunk_size buffer channel

let input_all channel =
  let buffer_size = in_channel_length channel - pos_in channel in
  let chunk_size = 65536 in
  let buffer = Buffer.create buffer_size in
  add_channel_to_the_end ~chunk_size buffer channel;
  Buffer.contents buffer

*)
