class File extends Path with Chars

An abstraction for files. For character data, a Codec can be supplied at either creation time or when a method involving character data is called (with the latter taking precedence if supplied.) If neither is available, the value of scala.io.Codec.default is used.

Since

2.8 Note: This is library is considered experimental and should not be used unless you know what you are doing.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. File
  2. Chars
  3. Bytes
  4. Path
  5. AnyRef
  6. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new File(jfile: java.io.File)(implicit constructorCodec: Codec)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. def /(child: File): File
    Definition Classes
    Path
  4. def /(child: Directory): Directory
    Definition Classes
    Path
  5. def /(child: Path): Path

    Creates a new Path with the specified path appended.

    Creates a new Path with the specified path appended. Assumes the type of the new component implies the type of the result.

    Definition Classes
    Path
  6. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. def addExtension(ext: String): File
    Definition Classes
    FilePath
  8. def appendAll(strings: String*): Unit
  9. def applyReader[T](f: (BufferedReader) ⇒ T): T

    Creates a BufferedReader and applies the closure, automatically closing it on completion.

    Creates a BufferedReader and applies the closure, automatically closing it on completion.

    Definition Classes
    Chars
  10. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  11. def bufferedInput(): BufferedInputStream
    Definition Classes
    Bytes
  12. def bufferedOutput(append: Boolean = false): BufferedOutputStream
  13. def bufferedReader(codec: Codec): BufferedReader
    Definition Classes
    Chars
  14. def bufferedReader(): BufferedReader

    Wraps a BufferedReader around the result of reader().

    Wraps a BufferedReader around the result of reader().

    Definition Classes
    Chars
  15. def bufferedWriter(append: Boolean, codec: Codec): BufferedWriter
  16. def bufferedWriter(append: Boolean): BufferedWriter
  17. def bufferedWriter(): BufferedWriter

    Wraps a BufferedWriter around the result of writer().

  18. def bytes(): Iterator[Byte]
    Definition Classes
    Bytes
  19. def bytesAsInts(): Iterator[Int]
    Definition Classes
    Bytes
  20. def canRead: Boolean
    Definition Classes
    Path
  21. def canWrite: Boolean
    Definition Classes
    Path
  22. def changeExtension(ext: String): Path
    Definition Classes
    Path
  23. def chars(codec: Codec): BufferedSource

    Caller is responsible for closing the returned BufferedSource.

    Caller is responsible for closing the returned BufferedSource.

    Definition Classes
    Chars
  24. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  25. def createDirectory(force: Boolean = true, failIfExists: Boolean = false): Directory
    Definition Classes
    Path
  26. def createFile(failIfExists: Boolean = false): File
    Definition Classes
    Path
  27. val creationCodec: Codec

    Calls to methods requiring byte<->char transformations should be offered in a form which allows specifying the codec.

    Calls to methods requiring byte<->char transformations should be offered in a form which allows specifying the codec. When it is not specified, the one discovered at creation time will be used, which will always find the one in scala.io.Codec if no other is available. This can be overridden to use a different default.

    Definition Classes
    FileChars
  28. def delete(): Boolean
    Definition Classes
    Path
  29. def deleteRecursively(): Boolean

    Deletes the path recursively.

    Deletes the path recursively. Returns false on failure. Use with caution!

    Definition Classes
    Path
  30. def endsWith(other: Path): Boolean
    Definition Classes
    Path
  31. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  32. def equals(other: Any): Boolean
    Definition Classes
    Path → AnyRef → Any
  33. def exists: Boolean
    Definition Classes
    Path
  34. def extension: String
    Definition Classes
    Path
  35. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  36. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  37. def hasExtension(ext: String, exts: String*): Boolean
    Definition Classes
    Path
  38. def hashCode(): Int
    Definition Classes
    Path → AnyRef → Any
  39. def ifDirectory[T](f: (Directory) ⇒ T): Option[T]
    Definition Classes
    Path
  40. def ifFile[T](f: (File) ⇒ T): Option[T]
    Definition Classes
    Path
  41. def inputStream(): FileInputStream

    Obtains an InputStream.

    Obtains an InputStream.

    Definition Classes
    FileBytes
  42. def isAbsolute: Boolean
    Definition Classes
    Path
  43. def isDirectory: Boolean
    Definition Classes
    Path
  44. def isEmpty: Boolean
    Definition Classes
    Path
  45. def isFile: Boolean
    Definition Classes
    Path
  46. def isFresher(other: Path): Boolean
    Definition Classes
    Path
  47. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  48. def isSame(other: Path): Boolean
    Definition Classes
    Path
  49. val jfile: java.io.File
    Definition Classes
    Path
  50. def lastModified: Long
    Definition Classes
    Path
  51. def length: Long
    Definition Classes
    FileBytesPath
  52. def lines(codec: Codec): Iterator[String]

    Beware! Leaks an InputStream which will not be closed until it gets finalized.

    Beware! Leaks an InputStream which will not be closed until it gets finalized.

    Definition Classes
    Chars
  53. def lines(): Iterator[String]

    Beware! Leaks an InputStream which will not be closed until it gets finalized.

    Beware! Leaks an InputStream which will not be closed until it gets finalized.

    Definition Classes
    Chars
  54. def name: String
    Definition Classes
    Path
  55. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  56. def normalize: File
    Definition Classes
    FilePath
  57. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  58. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  59. def outputStream(append: Boolean = false): FileOutputStream

    Obtains a OutputStream.

  60. def parent: Directory

    returns

    The path of the parent directory, or root if path is already root

    Definition Classes
    Path
  61. def parents: List[Directory]
    Definition Classes
    Path
  62. def path: String
    Definition Classes
    Path
  63. def printWriter(): PrintWriter
  64. def printlnAll(strings: String*): Unit

    Calls println on each string (so it adds a newline in the PrintWriter fashion.)

  65. def reader(codec: Codec): InputStreamReader

    Obtains an InputStreamReader wrapped around a FileInputStream.

    Obtains an InputStreamReader wrapped around a FileInputStream.

    Definition Classes
    Chars
  66. def relativize(other: Path): Path
    Definition Classes
    Path
  67. def resolve(other: Path): Path
    Definition Classes
    Path
  68. def safeSlurp(): Option[String]
  69. def segments: List[String]
    Definition Classes
    Path
  70. val separator: Char
    Definition Classes
    Path
  71. val separatorStr: String
    Definition Classes
    Path
  72. def setExecutable(executable: Boolean, ownerOnly: Boolean = true): Boolean

    Reflection since we're into the java 6+ API.

  73. def slurp(codec: Codec): String
    Definition Classes
    Chars
  74. def slurp(): String

    Convenience function to import entire file into a String.

    Convenience function to import entire file into a String.

    Definition Classes
    Chars
  75. def stripExtension: String
    Definition Classes
    Path
  76. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  77. def toAbsolute: File
    Definition Classes
    FilePath
  78. def toAbsoluteWithRoot(root: Path): Path

    If this path is absolute, returns it: otherwise, returns an absolute path made up of root / this.

    If this path is absolute, returns it: otherwise, returns an absolute path made up of root / this.

    Definition Classes
    Path
  79. def toByteArray(): Array[Byte]

    This method aspires to be the fastest way to read a stream of known length into memory.

    This method aspires to be the fastest way to read a stream of known length into memory.

    Definition Classes
    Bytes
  80. def toCanonical: Path
    Definition Classes
    Path
  81. def toDirectory: Directory
    Definition Classes
    FilePath
  82. def toFile: File
    Definition Classes
    FilePath
  83. def toString(): String
    Definition Classes
    Path → AnyRef → Any
  84. def toURI: URI
    Definition Classes
    Path
  85. def toURL: URL
    Definition Classes
    Path
  86. def truncate(): Boolean
    Definition Classes
    Path
  87. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  88. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  89. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  90. def walk: Iterator[Path]

    Equivalent to walkFilter(_ => true).

    Equivalent to walkFilter(_ => true).

    Definition Classes
    Path
  91. def walkFilter(cond: (Path) ⇒ Boolean): Iterator[Path]

    If this path is a directory, recursively iterate over its contents.

    If this path is a directory, recursively iterate over its contents. The supplied condition is a filter which is applied to each element, with that branch of the tree being closed off if it is false. So for example if the condition is false for some subdirectory, nothing under that directory will be in the Iterator. If it's true, all files for which the condition holds and are directly in that subdirectory are in the Iterator, and all sub-subdirectories are recursively evaluated

    Definition Classes
    FilePath
  92. def writeAll(strings: String*): Unit

    Creates a new file and writes all the Strings to it.

  93. def writer(append: Boolean, codec: Codec): OutputStreamWriter

    Obtains an OutputStreamWriter wrapped around a FileOutputStream.

    Obtains an OutputStreamWriter wrapped around a FileOutputStream. This should behave like a less broken version of java.io.FileWriter, in that unlike the java version you can specify the encoding.

Inherited from Chars

Inherited from Bytes

Inherited from Path

Inherited from AnyRef

Inherited from Any

Ungrouped