sbt

IO

object IO extends AnyRef

A collection of File, URL, and I/O utility methods.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. IO
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. val Newline: String

    The newline string for this system, as obtained by the line.

    The newline string for this system, as obtained by the line.separator system property.

  7. def append(file: File, bytes: Array[Byte]): Unit

  8. def append(file: File, content: String, charset: Charset = defaultCharset): Unit

  9. def asFile(url: URL): File

    Converts the given URL to a File.

    Converts the given URL to a File. If the URL is for an entry in a jar, the File for the jar is returned.

  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def assertAbsolute(uri: URI): Unit

  12. def assertAbsolute(f: File): Unit

  13. def assertDirectories(file: File*): Unit

  14. def assertDirectory(file: File): Unit

  15. def classLocation[T](implicit mf: Manifest[T]): URL

    Returns a URL for the directory or jar containing the class file for type T (as determined by an implicit Manifest).

    Returns a URL for the directory or jar containing the class file for type T (as determined by an implicit Manifest). If the location cannot be determined, an error is generated. Note that Java standard library classes typically do not have a location associated with them.

  16. def classLocation(cl: Class[_]): URL

    Returns a URL for the directory or jar containing the the class file cl.

    Returns a URL for the directory or jar containing the the class file cl. If the location cannot be determined, an error is generated. Note that Java standard library classes typically do not have a location associated with them.

  17. def classLocationFile[T](implicit mf: Manifest[T]): File

    Returns the directory or jar file containing the the class file for type T (as determined by an implicit Manifest).

    Returns the directory or jar file containing the the class file for type T (as determined by an implicit Manifest). If the location cannot be determined, an error is generated. Note that Java standard library classes typically do not have a location associated with them.

  18. def classLocationFile(cl: Class[_]): File

    Returns the directory or jar file containing the the class file cl.

    Returns the directory or jar file containing the the class file cl. If the location cannot be determined or it is not a file, an error is generated. Note that Java standard library classes typically do not have a location associated with them.

  19. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  20. def copy(sources: Traversable[(File, File)], overwrite: Boolean = false, preserveLastModified: Boolean = false): Set[File]

  21. def copyDirectory(source: File, target: File, overwrite: Boolean = false, preserveLastModified: Boolean = false): Unit

  22. def copyFile(sourceFile: File, targetFile: File, preserveLastModified: Boolean = false): Unit

  23. def copyLastModified(sourceFile: File, targetFile: File): Boolean

  24. def createDirectories(dirs: Traversable[File]): Unit

  25. def createDirectory(dir: File): Unit

  26. def createTemporaryDirectory: File

    Creates a directory in the default temporary directory with a name generated from a random integer.

  27. def createUniqueDirectory(baseDirectory: File): File

    Creates a directory in baseDirectory with a name generated from a random integer

  28. def defaultCharset: Charset

  29. def delete(file: File): Unit

    Deletes file, recursively if it is a directory.

  30. def delete(files: Iterable[File]): Unit

    Deletes each file or directory (recursively) in files.

  31. def deleteFilesEmptyDirs(files: Iterable[File]): Unit

    Deletes each file or directory in files recursively.

    Deletes each file or directory in files recursively. Any empty parent directories are deleted, recursively.

  32. def deleteIfEmpty(dirs: Set[File]): Unit

    Deletes all empty directories in the set.

    Deletes all empty directories in the set. Any non-empty directories are ignored.

  33. def directoryURI(uri: URI): URI

    Converts an absolute File to a URI.

    Converts an absolute File to a URI. The File is converted to a URI (toURI), normalized (normalize), encoded (toASCIIString), and a forward slash ('/') is appended to the path component if it does not already end with a slash.

  34. def directoryURI(dir: File): URI

    Converts an absolute File to a URI.

    Converts an absolute File to a URI. The File is converted to a URI (toURI), normalized (normalize), encoded (toASCIIString), and a forward slash ('/') is appended to the path component if it does not already end with a slash.

  35. def download(url: URL, to: File): Unit

    Retrieves the content of the given URL and writes it to the given File.

  36. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  37. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  38. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  39. def foldLines[T](in: BufferedReader, init: T)(f: (T, String) ⇒ T): T

  40. def foreachLine(in: BufferedReader)(f: (String) ⇒ Unit): Unit

  41. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  42. def gunzip(input: InputStream, output: OutputStream): Unit

    Gunzips the InputStream 'input' and writes it to 'output'.

    Gunzips the InputStream 'input' and writes it to 'output'. Neither stream is closed.

  43. def gunzip(in: File, out: File): Unit

    Gunzips the file 'in' and writes it to 'out'.

    Gunzips the file 'in' and writes it to 'out'. 'in' cannot be the same file as 'out'.

  44. def gzip(input: InputStream, output: OutputStream): Unit

    Gzips the InputStream 'in' and writes it to 'output'.

    Gzips the InputStream 'in' and writes it to 'output'. Neither stream is closed.

  45. def gzip(in: File, out: File): Unit

    Gzips the file 'in' and writes it to 'out'.

    Gzips the file 'in' and writes it to 'out'. 'in' cannot be the same file as 'out'.

  46. def gzipFileIn[T](file: File)(f: (InputStream) ⇒ T): T

  47. def gzipFileOut[T](file: File)(f: (OutputStream) ⇒ T): T

  48. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  49. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  50. def jar(sources: Traversable[(File, String)], outputJar: File, manifest: Manifest): Unit

    Creates a jar file.

    Creates a jar file.

    sources

    The files to include in the jar file paired with the entry name in the jar. Only the pairs explicitly listed are included.

    outputJar

    The file to write the jar to.

    manifest

    The manifest for the jar.

  51. def listFiles(dir: File): Array[File]

    Returns the children of directory dir in a non-null array.

  52. def listFiles(dir: File, filter: FileFilter): Array[File]

    Returns the children of directory dir that match filter in a non-null array.

  53. def listFiles(filter: FileFilter)(dir: File): Array[File]

    Returns the children of directory dir that match filter in a non-null array.

  54. def load(properties: Properties, from: File): Unit

  55. def move(a: File, b: File): Unit

  56. def move(files: Traversable[(File, File)]): Unit

  57. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  58. final def notify(): Unit

    Definition Classes
    AnyRef
  59. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  60. def objectInputStream(wrapped: InputStream, loader: ClassLoader): ObjectInputStream

  61. def parseClasspath(s: String): Seq[File]

  62. def pathSplit(s: String): Array[String]

    Splits a String around path separator characters.

  63. def read(file: File, charset: Charset = defaultCharset): String

  64. def readBytes(in: InputStream): Array[Byte]

    doesn't close the InputStream

  65. def readBytes(file: File): Array[Byte]

  66. def readLines(in: BufferedReader): List[String]

  67. def readLines(file: File, charset: Charset = defaultCharset): List[String]

  68. def readLinesURL(url: URL, charset: Charset = defaultCharset): List[String]

  69. def readStream(in: InputStream, charset: Charset = defaultCharset): String

    doesn't close the InputStream

  70. def reader[T](file: File, charset: Charset = defaultCharset)(f: (BufferedReader) ⇒ T): T

  71. def relativize(base: File, file: File): Option[String]

  72. def resolve(base: File, f: File): File

  73. def split(name: String): (String, String)

    Splits the given string into base and extension strings.

    Splits the given string into base and extension strings. If name contains no period, the base string is the input string and the extension is the empty string. Otherwise, the base is the substring up until the last period (exclusive) and the extension is the substring after the last period.

    For example, split("Build.scala") == ("Build", "scala")

  74. def stash[T](files: Set[File])(f: ⇒ T): T

    Move the provided files to a temporary location.

    Move the provided files to a temporary location. If 'f' returns normally, delete the files. If 'f' throws an Exception, return the files to their original location.

  75. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  76. val temporaryDirectory: File

  77. def toFile(url: URL): File

    Constructs a File corresponding to url, which must have a scheme of file.

    Constructs a File corresponding to url, which must have a scheme of file. This method properly works around an issue with a simple conversion to URI and then to a File.

  78. def toString(): String

    Definition Classes
    AnyRef → Any
  79. def toURI(f: File): URI

    Converts the given File to a URI.

    Converts the given File to a URI. If the File is relative, the URI is relative, unlike File.toURI

  80. def touch(file: File, setModified: Boolean = true): Unit

    Creates a file at the given location if it doesn't exist.

    Creates a file at the given location if it doesn't exist. If the file already exists and setModified is true, this method sets the last modified time to the current time.

  81. def touch(files: Traversable[File]): Unit

    Each input file in files is created if it doesn't exist.

    Each input file in files is created if it doesn't exist. If a file already exists, the last modified time is set to the current time. It is not guaranteed that all files will have the same last modified time after this call.

  82. def transfer(in: InputStream, out: OutputStream): Unit

    Copies all bytes from the given input stream to the given output stream.

    Copies all bytes from the given input stream to the given output stream. Neither stream is closed.

  83. def transfer(in: InputStream, to: File): Unit

    Copies all bytes from the given input stream to the given File.

    Copies all bytes from the given input stream to the given File. The input stream is not closed by this method.

  84. def transfer(in: File, out: OutputStream): Unit

    Copies the contents of the input file in to the out stream.

    Copies the contents of the input file in to the out stream. The output stream is not closed by this method.

  85. def transfer(in: File, out: File): Unit

    Copies the contents of in to out.

  86. def transferAndClose(in: InputStream, out: OutputStream): Unit

    Copies all bytes from the given input stream to the given output stream.

    Copies all bytes from the given input stream to the given output stream. The input stream is closed after the method completes.

  87. def unzip(from: File, toDirectory: File, filter: NameFilter = AllPassFilter, preserveLastModified: Boolean = true): Set[File]

  88. def unzipStream(from: InputStream, toDirectory: File, filter: NameFilter = AllPassFilter, preserveLastModified: Boolean = true): Set[File]

  89. def unzipURL(from: URL, toDirectory: File, filter: NameFilter = AllPassFilter, preserveLastModified: Boolean = true): Set[File]

  90. def urlAsFile(url: URL): Option[File]

  91. val utf8: Charset

  92. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  93. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  94. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  95. def withTemporaryDirectory[T](action: (File) ⇒ T): T

    Creates a temporary directory and provides its location to the given function.

    Creates a temporary directory and provides its location to the given function. The directory is deleted after the function returns.

  96. def withTemporaryFile[T](prefix: String, postfix: String)(action: (File) ⇒ T): T

    Creates a file in the default temporary directory, calls action with the file, deletes the file, and returns the result of calling action.

    Creates a file in the default temporary directory, calls action with the file, deletes the file, and returns the result of calling action. The name of the file will begin with prefix, which must be at least three characters long, and end with postfix, which has no minimum length.

  97. def write(properties: Properties, label: String, to: File): Unit

  98. def write(file: File, bytes: Array[Byte]): Unit

  99. def write(file: File, content: String, charset: Charset = defaultCharset, append: Boolean = false): Unit

  100. def writeLines(writer: PrintWriter, lines: Seq[String]): Unit

  101. def writeLines(file: File, lines: Seq[String], charset: Charset = defaultCharset, append: Boolean = false): Unit

  102. def writer[T](file: File, content: String, charset: Charset, append: Boolean = false)(f: (BufferedWriter) ⇒ T): T

  103. def zip(sources: Traversable[(File, String)], outputZip: File): Unit

    Creates a zip file.

    Creates a zip file.

    sources

    The files to include in the zip file paired with the entry name in the zip. Only the pairs explicitly listed are included.

    outputZip

    The file to write the zip to.

Inherited from AnyRef

Inherited from Any