
  [;1m-spec read(IoDevice, Number) -> {ok, Data} | eof | {error, Reason}[0m
  [;1m              when[0m
  [;1m                  IoDevice :: io_device() | io:device(),[0m
  [;1m                  Number :: non_neg_integer(),[0m
  [;1m                  Data :: string() | binary(),[0m
  [;1m                  Reason ::[0m
  [;1m                      posix() |[0m
  [;1m                      badarg | terminated |[0m
  [;1m                      {no_translation, unicode, latin1}.[0m

  Reads [;;4mNumber[0m bytes/characters from the file referenced by [;;4m[0m
  [;;4mIoDevice[0m. The functions [;;4mread/2[0m, [;;4mpread/3[0m, and [;;4mread_line/1[0m
  are the only ways to read from a file opened in [;;4mraw[0m mode
  (although they work for normally opened files, too).

  For files where [;;4mencoding[0m is set to something else than [;;4mlatin1[0m,
  one character can be represented by more than one byte on the
  file. The parameter [;;4mNumber[0m always denotes the number of 
  characters read from the file, while the position in the file can
  be moved much more than this number when reading a Unicode file.

  Also, if [;;4mencoding[0m is set to something else than [;;4mlatin1[0m, the [;;4m[0m
  [;;4mread/2[0m call fails if the data contains characters larger than
  255, which is why [;;4mio:get_chars/3[0m is to be preferred when reading
  such a file.

  The function returns:

  [;;4m[;;4m{ok, Data}[0m[0m:
    If the file was opened in binary mode, the read bytes are
    returned in a binary, otherwise in a list. The list or binary
    is shorter than the number of bytes requested if end of file
    was reached.

  [;;4m[;;4meof[0m[0m:
    Returned if [;;4mNumber>0[0m and end of file was reached before
    anything at all could be read.

  [;;4m[;;4m{error, Reason}[0m[0m:
    An error occurred.

  Typical error reasons:

  [;;4m[;;4mebadf[0m[0m:
    The file is not opened for reading.

  [;;4m[;;4m{no_translation, unicode, latin1}[0m[0m:
    The file is opened with another [;;4mencoding[0m than [;;4mlatin1[0m and
    the data in the file cannot be translated to the byte-oriented
    data that this function returns.
