object File extends Serializable
This defines some very useful methods to interact with text files at a high abstraction level.
- Source
- File.scala
- Alphabetic
- By Inheritance
- File
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
ReadLineWise(f: File)(proc: (String) ⇒ Unit): Unit
convenience method to read a file line by line
convenience method to read a file line by line
- f
the file
- proc
a function applied to every line (without line terminator)
-
def
Reader(f: File): BufferedReader
convenience method to obtain a typical (buffered, UTF-8) reader for a file
convenience method to obtain a typical (buffered, UTF-8) reader for a file
If f does not exist, Compress.name(f) is tried and automatically decompressed.
-
def
WriteLineWise(f: File, lines: List[String]): Unit
convenience method for writing a list of lines into a file
convenience method for writing a list of lines into a file
overwrites existing files, creates directories if necessary
- f
the target file
- lines
the lines (without line terminator - will be chosen by Java and appended)
-
def
Writer(f: File, compress: Boolean = false): StandardPrintWriter
- compress
if true, the file is compressed while writing
- def append(f: File, strings: String*): Unit
-
def
apply(s: String): File
constructs a File from a string, using the java.io.File parser
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
copy(from: File, to: File, replace: Boolean): Boolean
copies a file
-
def
download(uri: URI, file: File): Unit
dereference a URL and save as a file
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
implicit
def
java2Scala(file: java.io.File): File
implicit conversion Java <-> Scala
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
read(f: File): String
convenience method for reading a file into a string
convenience method for reading a file into a string
- f
the source file
- returns
s the file content (line terminators are \n)
- def readProperties(manifest: File): Map[String, String]
- def readPropertiesFromString(s: String): Map[String, String]
-
implicit
def
scala2Java(file: File): java.io.File
implicit conversion Java <-> Scala
-
def
stream(f: File, begin: String = "", sep: String = "", end: String = "")(work: ((String) ⇒ Unit) ⇒ Unit): Unit
streams a list-like object to a file
streams a list-like object to a file
- f
the file to write to
- begin
initial text
- sep
text in between elements
- end
terminal text
- work
bind a variable "write" and call it to write into the file example: (l: List[Node]) => stream(f, "<root>", "\n", "</root>"){out => l map {a => out(a.toString)}}
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unzip(from: File, toDir: File, skipRootDir: Boolean = false): Unit
unzips a file
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
write(f: File, strings: String*): Unit
convenience method for writing a string into a file
convenience method for writing a string into a file
overwrites existing files, creates directories if necessary
- f
the target file
- strings
the content to write