Skip to content

Commit

Permalink
Merge branch 'jd/file-ram-opt-doc' into master-pu
Browse files Browse the repository at this point in the history
  • Loading branch information
proxyles committed Nov 26, 2012
2 parents 734968f + 2efd04e commit 4a17888
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/kernel/doc/src/file.xml
Expand Up @@ -622,7 +622,7 @@
<name name="open" arity="2"/>
<fsummary>Open a file</fsummary>
<desc>
<p>Opens the file <c><anno>Filename</anno></c> in the mode determined
<p>Opens the file <c><anno>File</anno></c> in the mode determined
by <c><anno>Modes</anno></c>, which may contain one or more of the
following items:</p>
<taglist>
Expand Down Expand Up @@ -779,6 +779,10 @@
<p>The Encoding can be changed for a file "on the fly" by using the <seealso marker="stdlib:io#setopts/2">io:setopts/2</seealso> function, why a file can be analyzed in latin1 encoding for i.e. a BOM, positioned beyond the BOM and then be set for the right encoding before further reading.See the <seealso marker="stdlib:unicode">unicode(3)</seealso> module for functions identifying BOM's.</p>
<p>This option is not allowed on <c>raw</c> files.</p>
</item>
<tag><c>ram</c></tag>
<item>
<p><c>File</c> must be <c>iodata()</c>. Returns an <c>fd()</c> which lets the <c>file</c> module operate on the data in-memory as if it is a file.</p>
</item>
</taglist>
<p>Returns:</p>
<taglist>
Expand Down
5 changes: 3 additions & 2 deletions lib/kernel/src/file.erl
Expand Up @@ -88,7 +88,7 @@
| {'cur', Offset :: integer()}
| {'eof', Offset :: integer()} | 'bof' | 'cur' | 'eof'.
-type mode() :: 'read' | 'write' | 'append'
| 'exclusive' | 'raw' | 'binary'
| 'exclusive' | 'raw' | 'binary' | 'ram'
| {'delayed_write',
Size :: non_neg_integer(),
Delay :: non_neg_integer()}
Expand Down Expand Up @@ -397,7 +397,8 @@ raw_write_file_info(Name, #file_info{} = Info) ->

%% Contemporary mode specification - list of options

-spec open(Filename, Modes) -> {ok, IoDevice} | {error, Reason} when
-spec open(File, Modes) -> {ok, IoDevice} | {error, Reason} when
File :: Filename | iodata(),
Filename :: name(),
Modes :: [mode()],
IoDevice :: io_device(),
Expand Down

0 comments on commit 4a17888

Please sign in to comment.