blob: 574cebda307b564e1effc8522f5a69aa9eb7ef5f [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<document url="FileExtensions.html">
<!--
WARNING: This file is automatically generated from a jsdoc processor that
turns javadoc-type comments of Javascript and special Java files into an xml file, which is
then processed by an xsl file to create this document. Do not modify this
file, but rather either modify the comments or xsl file.
-->
<properties>
<title>java.io.File Extensions</title>
</properties>
<body>
<section href="summary" name="java.io.File Extensions">
<p>Adds various functions to java.io.File</p>
<dl/>
<table width="100%">
<tr>
<th colspan="2">Function Summary</th>
</tr>
<tr>
<td width="5%">
<code>java.io.File</code>
</td>
<td>
<strong>
<code>
<a href="#fn_append">append(String text)</a>
</code>
</strong>
<dd>Appends text to the file.</dd>
</td>
</tr>
<tr>
<td width="5%">
<code>String</code>
</td>
<td>
<strong>
<code>
<a href="#fn_getText">getText()</a>
</code>
</strong>
<dd>Gets the contents of the file as a String.</dd>
</td>
</tr>
<tr>
<td width="5%">
<code>void</code>
</td>
<td>
<strong>
<code>
<a href="#fn_eachLine">eachLine(Function func)</a>
</code>
</strong>
<dd>Passes each line to the provided function.</dd>
</td>
</tr>
<tr>
<td width="5%">
<code>String[]</code>
</td>
<td>
<strong>
<code>
<a href="#fn_getLines">getLines()</a>
</code>
</strong>
<dd>Collects the contents of the file as an array of lines.</dd>
</td>
</tr>
<tr>
<td width="5%">
<code>boolean</code>
</td>
<td>
<strong>
<code>
<a href="#fn_remove">remove()</a>
</code>
</strong>
<dd>Removes a file.</dd>
</td>
</tr>
</table>
</section>
<section name="Functions">
<section href="fn_append" name="append">
<pre>java.io.File append(String text)</pre>
<p>Appends text to the file.</p>
<dl>
<dt>
<strong>Example: </strong>
</dt>
<dd>
<pre>file.append("added text")</pre>
</dd>
</dl>
</section>
<section href="fn_getText" name="getText">
<pre>String getText()</pre>
<p>Gets the contents of the file as a String.</p>
<dl>
<dt>
<strong>Example: </strong>
</dt>
<dd>
<pre>text = file.getText()</pre>
</dd>
</dl>
</section>
<section href="fn_eachLine" name="eachLine">
<pre>void eachLine(Function func)</pre>
<p>Passes each line to the provided function. The file is opened, and interpreted as a text file using the default encoding. Each line is read and passed to the provided function.</p>
<dl>
<dt>
<strong>Example: </strong>
</dt>
<dd>
<pre>file.eachLine(function(line) { print(line) })</pre>
</dd>
</dl>
</section>
<section href="fn_getLines" name="getLines">
<pre>String[] getLines()</pre>
<p>Collects the contents of the file as an array of lines. The file is opened, and interpreted as a text file using the default encoding.</p>
<dl>
<dt>
<strong>Example: </strong>
</dt>
<dd>
<pre>linesArray = file.getLines()</pre>
</dd>
</dl>
</section>
<section href="fn_remove" name="remove">
<pre>boolean remove()</pre>
<p>Removes a file. Used to get around the problem of the reserved word 'delete'.</p>
<dl>
<dt>
<strong>Example: </strong>
</dt>
<dd>
<pre>isRemoved = file.remove()</pre>
</dd>
</dl>
</section>
</section>
</body>
</document>