scalax.io

class FileExtras

[source: scalax/io/FileExtras.scala]

class FileExtras(file : java.io.File)
extends AnyRef
Adds extra methods to File.
Method Summary
def / (child : java.lang.String) : java.io.File
def appendOutputStream : OutputStreamResource[java.io.FileOutputStream]
def copyTo (dest : java.io.File) : Unit
Copies the file.
def deleteRecursively : Boolean
Deletes the file or directory recursively. Returns false if it failed.
def extension : scala.Option[java.lang.String]
Attempts to return the file extension.
def inChannel : ManagedResource[java.nio.channels.FileChannel]
Obtains an input FileChannel.
def inputStream : InputStreamResource[java.io.FileInputStream]
Obtains an InputStream.
def lines (charset : java.lang.String) : ManagedSequence[java.lang.String]
Views the file as a sequence of lines.
def lines : ManagedSequence[java.lang.String]
Views the file as a sequence of lines.
def moveTo (dest : java.io.File) : Unit
Moves the file, by rename if possible, otherwise by copy-and-delete.
def outChannel : ManagedResource[java.nio.channels.FileChannel]
Obtains an output FileChannel.
def outputStream : OutputStreamResource[java.io.FileOutputStream]
Obtains a OutputStream.
def printWriter : WriterResource[java.io.PrintWriter]
def readLine : java.lang.String
def readLines : scala.Seq[java.lang.String]
def reader (charset : java.lang.String) : ReaderResource[java.io.Reader] with Wrapper
Obtains a BufferedReader using the supplied charset.
def reader : ReaderResource[java.io.Reader] with Wrapper
Obtains a Reader using the system default charset.
def slurp : java.lang.String
Slurps the entire input file into a string, using the system default character set.
def slurp (charset : java.lang.String) : java.lang.String
Slurps the entire input file into a string, using the supplied character set.
def tree : FileTree
Returns a FileTree for this file.
def unzipTo (outdir : java.io.File) : Unit
Unzips the file into the specified directory.
def write (s : java.lang.String) : Unit
Writes the supplied string to the file, replacing any existing content, using the system default character set.
def write (s : java.lang.String, charset : java.lang.String) : Unit
Writes the supplied string to the file, replacing any existing content, using the supplied character set.
def writeLine (line : java.lang.String) : Unit
def writeLines (lines : scala.Seq[java.lang.String]) : Unit
def writeString (s : java.lang.String) : Unit
def writer : WriterResource[java.io.Writer] with Wrapper
Obtains a Writer using the system default charset.
def writer (charset : java.lang.String) : WriterResource[java.io.Writer] with Wrapper
Obtains a Writer using the supplied charset.
Methods inherited from AnyRef
getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
Methods inherited from Any
==, !=, isInstanceOf, asInstanceOf
Method Details
def deleteRecursively : Boolean
Deletes the file or directory recursively. Returns false if it failed.

def tree : FileTree
Returns a FileTree for this file.

def reader : ReaderResource[java.io.Reader] with Wrapper
Obtains a Reader using the system default charset.

def reader(charset : java.lang.String) : ReaderResource[java.io.Reader] with Wrapper
Obtains a BufferedReader using the supplied charset.

def writer : WriterResource[java.io.Writer] with Wrapper
Obtains a Writer using the system default charset.

def writer(charset : java.lang.String) : WriterResource[java.io.Writer] with Wrapper
Obtains a Writer using the supplied charset.

def printWriter : WriterResource[java.io.PrintWriter]

def inputStream : InputStreamResource[java.io.FileInputStream]
Obtains an InputStream.

def outputStream : OutputStreamResource[java.io.FileOutputStream]
Obtains a OutputStream.

def appendOutputStream : OutputStreamResource[java.io.FileOutputStream]

def inChannel : ManagedResource[java.nio.channels.FileChannel]
Obtains an input FileChannel.

def outChannel : ManagedResource[java.nio.channels.FileChannel]
Obtains an output FileChannel.

def extension : scala.Option[java.lang.String]
Attempts to return the file extension.

def slurp : java.lang.String
Slurps the entire input file into a string, using the system default character set.

def slurp(charset : java.lang.String) : java.lang.String
Slurps the entire input file into a string, using the supplied character set.

def lines : ManagedSequence[java.lang.String]
Views the file as a sequence of lines.

def lines(charset : java.lang.String) : ManagedSequence[java.lang.String]
Views the file as a sequence of lines.

def readLines : scala.Seq[java.lang.String]

def readLine : java.lang.String

def write(s : java.lang.String) : Unit
Writes the supplied string to the file, replacing any existing content, using the system default character set.

def write(s : java.lang.String, charset : java.lang.String) : Unit
Writes the supplied string to the file, replacing any existing content, using the supplied character set.

def writeString(s : java.lang.String) : Unit

def writeLine(line : java.lang.String) : Unit

def writeLines(lines : scala.Seq[java.lang.String]) : Unit

def copyTo(dest : java.io.File) : Unit
Copies the file.

def moveTo(dest : java.io.File) : Unit
Moves the file, by rename if possible, otherwise by copy-and-delete.

def unzipTo(outdir : java.io.File) : Unit
Unzips the file into the specified directory.

def /(child : java.lang.String) : java.io.File


Copyright (c) 2005-8 The Scalax Project. All Rights Reserved.