IOData.File (iodata v0.6.0)
A structure that represents a file and can be used with IOData. A File
can
be opened or wrapped around an existing file-descriptor or reference.
Examples
iex> {:ok, slice} = IOData.File.open("path/to/file")
iex> IOData.to_binary(slice)
{:ok, <<0, 1, 2, 3, 4, 5, 6, 7, 8, 9>>}
iex> {head, tail} = IOData.split!(slice, 5)
iex> IOData.to_binary(tail)
{:ok, <<5, 6, 7, 8, 9>>}
Summary
Functions
Opens a file and returns a slice that can be used with IOData. The slice represents the entire file.
Opens a file and returns a slice that can be used with IOData. The slice represents the entire file. If the file cannot be opened, an exception is raised.
Wraps an existing file or reference in a slice that can be used with IOData. A length is required in order to provide boundary checking.
Types
@type t() :: %IOData.File{ count: non_neg_integer(), file: pid() | reference(), start: non_neg_integer() }
Functions
Opens a file and returns a slice that can be used with IOData. The slice represents the entire file.
Opens a file and returns a slice that can be used with IOData. The slice represents the entire file. If the file cannot be opened, an exception is raised.
@spec wrap( file :: pid() | reference(), start :: non_neg_integer(), count :: non_neg_integer() ) :: t()
Wraps an existing file or reference in a slice that can be used with IOData. A length is required in order to provide boundary checking.