Class/Object

better.files

File

Related Docs: object File | package files

Permalink

class File extends AnyRef

Scala wrapper around java.nio.files.Path

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. File
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def /(child: Symbol): File

    Permalink
  4. def /(child: String): File

    Permalink
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. def addPermission(permission: PosixFilePermission)(implicit linkOptions: LinkOptions = File.LinkOptions.default): File.this.type

    Permalink
  7. def append(text: String)(implicit charset: Charset = DefaultCharset): File.this.type

    Permalink
  8. def appendByteArray(bytes: Array[Byte]): File.this.type

    Permalink
  9. def appendBytes(bytes: Iterator[Byte]): File.this.type

    Permalink
  10. def appendLine(line: String = "")(implicit charset: Charset = DefaultCharset): File.this.type

    Permalink
  11. def appendLines(lines: String*)(implicit charset: Charset = DefaultCharset): File.this.type

    Permalink

    For large number of lines that may not fit in memory, use printLines

  12. def appendText(text: String)(implicit charset: Charset = DefaultCharset): File.this.type

    Permalink
  13. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  14. def asynchronousFileChannel(implicit openOptions: OpenOptions = File.OpenOptions.default): ManagedResource[AsynchronousFileChannel]

    Permalink
  15. def attributes(implicit linkOptions: LinkOptions = File.LinkOptions.default): BasicFileAttributes

    Permalink
  16. def bufferedReader(implicit charset: Charset = DefaultCharset): ManagedResource[BufferedReader]

    Permalink
  17. def bufferedWriter(implicit charset: Charset = DefaultCharset, openOptions: OpenOptions = File.OpenOptions.default): ManagedResource[BufferedWriter]

    Permalink
  18. def byteArray: Array[Byte]

    Permalink
  19. def bytes: Iterator[Byte]

    Permalink
  20. def changeExtensionTo(extension: String): File

    Permalink

    Changes the file-extension by renaming this file; if file does not have an extension, it adds the extension Example usage file"foo.java".changeExtensionTo(".scala")

  21. def chars(implicit charset: Charset = DefaultCharset): Iterator[Char]

    Permalink
  22. def checksum(algorithm: MessageDigest): String

    Permalink

    returns

    checksum of this file (or directory) in hex format

  23. def children: Files

    Permalink
  24. def clear()(implicit linkOptions: LinkOptions = File.LinkOptions.default): File.this.type

    Permalink

    If this is a directory, remove all its children If its a file, empty the contents

    If this is a directory, remove all its children If its a file, empty the contents

    returns

    this

  25. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. def collectChildren(matchFilter: (File) ⇒ Boolean)(implicit visitOptions: VisitOptions = File.VisitOptions.default): Files

    Permalink

    More Scala friendly way of doing Files.walk Note: This is lazy (returns an Iterator) and won't evaluate till we reify the iterator (e.g.

    More Scala friendly way of doing Files.walk Note: This is lazy (returns an Iterator) and won't evaluate till we reify the iterator (e.g. using .toList)

  27. def contains(file: File): Boolean

    Permalink

    Check if this directory contains this file

    Check if this directory contains this file

    returns

    true if this is a directory and it contains this file

  28. def contentAsString(implicit charset: Charset = DefaultCharset): String

    Permalink
  29. def contentType: Option[String]

    Permalink
  30. def copyTo(destination: File, overwrite: Boolean = false)(implicit copyOptions: CopyOptions = File.CopyOptions(overwrite)): destination.type

    Permalink

    returns

    destination

  31. def copyToDirectory(directory: File)(implicit linkOptions: LinkOptions = File.LinkOptions.default, copyOptions: CopyOptions = File.CopyOptions.default): File

    Permalink

    Copies this file into the given directory

    Copies this file into the given directory

    returns

    the File referencing the new file created under destination

  32. def createChild(child: String, asDirectory: Boolean = false, createParents: Boolean = false)(implicit attributes: Attributes = File.Attributes.default, linkOptions: LinkOptions = File.LinkOptions.default): File

    Permalink
  33. def createDirectories()(implicit attributes: Attributes = File.Attributes.default, linkOptions: LinkOptions = File.LinkOptions.default): File.this.type

    Permalink

    Create this directory and all its parents Unlike the JDK, this by default sanely handles the JDK-8130464 bug If you want default Java behaviour, use File.LinkOptions.noFollow

  34. def createDirectory()(implicit attributes: Attributes = File.Attributes.default): File.this.type

    Permalink

    Create this directory

  35. def createFile()(implicit attributes: Attributes = File.Attributes.default): File.this.type

    Permalink

    Create this file

  36. def createIfNotExists(asDirectory: Boolean = false, createParents: Boolean = false)(implicit attributes: Attributes = File.Attributes.default, linkOptions: LinkOptions = File.LinkOptions.default): File.this.type

    Permalink

    Create this file.

    Create this file. If it exists, don't do anything

    asDirectory

    If you want this file to be created as a directory instead, set this to true (false by default)

    createParents

    If you also want all the parents to be created from root to this file (false by default)

  37. def delete(swallowIOExceptions: Boolean = false): File.this.type

    Permalink

    Deletes this file or directory

    Deletes this file or directory

    swallowIOExceptions

    If this is set to true, any exception thrown is swallowed

  38. def deleteOnExit(): File.this.type

    Permalink
  39. def digest(algorithm: MessageDigest): Array[Byte]

    Permalink
  40. def digestInputStream(digest: MessageDigest)(implicit openOptions: OpenOptions = File.OpenOptions.default): ManagedResource[DigestInputStream]

    Permalink
  41. def dosAttributes(implicit linkOptions: LinkOptions = File.LinkOptions.default): DosFileAttributes

    Permalink
  42. def entries: Files

    Permalink
  43. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  44. def equals(obj: Any): Boolean

    Permalink
    Definition Classes
    File → AnyRef → Any
  45. def exists(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  46. def extension(includeDot: Boolean = true, includeAll: Boolean = false, toLowerCase: Boolean = true): Option[String]

    Permalink

    includeDot

    whether the dot should be included in the extension or not

    includeAll

    whether all extension tokens should be included, or just the last one e.g. for bundle.tar.gz should it be .tar.gz or .gz

    toLowerCase

    to lowercase the extension or not e.g. foo.HTML should have .html or .HTML

    returns

    extension of this file if it is a regular file and has an extension, else None

  47. def extension: Option[String]

    Permalink

    returns

    extension (including the dot) of this file if it is a regular file and has an extension, else None

  48. def fileChannel(implicit openOptions: OpenOptions = File.OpenOptions.default, attributes: Attributes = File.Attributes.default): ManagedResource[FileChannel]

    Permalink
  49. def fileInputStream: ManagedResource[FileInputStream]

    Permalink
  50. def fileOutputStream(append: Boolean = false): ManagedResource[FileOutputStream]

    Permalink
  51. def fileReader: ManagedResource[FileReader]

    Permalink
  52. implicit val fileSystem: FileSystem

    Permalink
  53. def fileWriter(append: Boolean = false): ManagedResource[FileWriter]

    Permalink
  54. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  55. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  56. def glob(pattern: String, includePath: Boolean = true)(implicit syntax: PathMatcherSyntax = File.PathMatcherSyntax.default, visitOptions: VisitOptions = File.VisitOptions.default): Files

    Permalink

    Util to glob from this file's path

    Util to glob from this file's path

    includePath

    If true, we don't need to set path glob patterns e.g. instead of *

  57. def globRegex(pattern: Regex, includePath: Boolean = true)(implicit visitOptions: VisitOptions = File.VisitOptions.default): Files

    Permalink

    Util to match from this file's path using Regex

    Util to match from this file's path using Regex

    includePath

    If true, we don't need to set path glob patterns e.g. instead of *

  58. def group(implicit linkOptions: LinkOptions = File.LinkOptions.default): GroupPrincipal

    Permalink
  59. def groupName(implicit linkOptions: LinkOptions = File.LinkOptions.default): String

    Permalink
  60. def gzipInputStream(bufferSize: Int = DefaultBufferSize): ManagedResource[GZIPInputStream]

    Permalink
  61. def gzipOutputStream(bufferSize: Int = DefaultBufferSize, syncFlush: Boolean = false, append: Boolean = false): ManagedResource[GZIPOutputStream]

    Permalink
  62. def gzipTo(destination: File = ..., bufferSize: Int = DefaultBufferSize, syncFlush: Boolean = false, append: Boolean = false): destination.type

    Permalink

  63. def hasExtension: Boolean

    Permalink

    Returns the extension if file is a regular file If file is unreadable or does not exist, it is assumed to be not a regular file See: https://github.com/pathikrit/better-files/issues/89

  64. def hashCode(): Int

    Permalink
    Definition Classes
    File → AnyRef → Any
  65. def inputStream(implicit openOptions: OpenOptions = File.OpenOptions.default): ManagedResource[InputStream]

    Permalink
  66. def isChildOf(parent: File): Boolean

    Permalink
  67. def isDirectory(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink

    returns

    true if this file (or the file found by following symlink) is a directory

  68. def isEmpty(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink

    returns

    true if file is not present or empty directory or 0-bytes file

  69. def isExecutable: Boolean

    Permalink
  70. def isGroupExecutable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  71. def isGroupReadable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  72. def isGroupWritable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  73. def isHidden: Boolean

    Permalink
  74. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  75. def isLocked(mode: RandomAccessMode, position: Long = 0L, size: Long = Long.MaxValue, isShared: Boolean = false)(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink

    Check if a file is locked.

    Check if a file is locked.

    mode

    The random access mode.

    position

    The position at which the locked region is to start; must be non-negative.

    size

    The size of the locked region; must be non-negative, and the sum position + size must be non-negative.

    isShared

    true to request a shared lock, false to request an exclusive lock.

    returns

    True if the file is locked, false otherwise.

  76. def isOthersExecutable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  77. def isOthersReadable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  78. def isOthersWritable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  79. def isOwnerExecutable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  80. def isOwnerReadable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  81. def isOwnerWritable(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  82. def isParentOf(child: File): Boolean

    Permalink
  83. def isReadLocked(position: Long = 0L, size: Long = Long.MaxValue, isShared: Boolean = false): Boolean

    Permalink
  84. def isReadable: Boolean

    Permalink

    This differs from the above as this checks if the JVM can read this file even though the OS cannot in certain platforms

    This differs from the above as this checks if the JVM can read this file even though the OS cannot in certain platforms

    See also

    isOwnerReadable

  85. def isRegularFile(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink

    returns

    true if this file (or the file found by following symlink) is a regular file

  86. def isSameContentAs(that: File): Boolean

    Permalink

    returns

    true if this file is exactly same as that file For directories, it checks for equivalent directory structure

  87. def isSameFileAs(that: File): Boolean

    Permalink
  88. def isSamePathAs(that: File): Boolean

    Permalink
  89. def isSiblingOf(sibling: File): Boolean

    Permalink
  90. def isSimilarContentAs(that: File): Boolean

    Permalink

    Almost same as isSameContentAs but uses faster md5 hashing to compare (and thus small chance of false positive) Also works for directories

  91. def isSymbolicLink: Boolean

    Permalink
  92. def isWriteLocked(position: Long = 0L, size: Long = Long.MaxValue, isShared: Boolean = false): Boolean

    Permalink
  93. def isWriteable: Boolean

    Permalink
  94. def lastModifiedTime(implicit linkOptions: LinkOptions = File.LinkOptions.default): Instant

    Permalink
  95. def lineIterator(implicit charset: Charset = DefaultCharset): Iterator[String]

    Permalink

    Iterate over lines in a file (auto-close stream on complete) NOTE: If the iteration is partial, it may leave a stream open If you want partial iteration use @see lines()

  96. def lines(implicit charset: Charset = DefaultCharset): Traversable[String]

    Permalink

    Load all lines from this file Note: Large files may cause an OutOfMemory in which case, use the streaming version @see lineIterator

    Load all lines from this file Note: Large files may cause an OutOfMemory in which case, use the streaming version @see lineIterator

    returns

    all lines in this file

  97. def linkTo(destination: File, symbolic: Boolean = false)(implicit attributes: Attributes = File.Attributes.default): destination.type

    Permalink
  98. def list: Files

    Permalink
  99. def listRecursively(implicit visitOptions: VisitOptions = File.VisitOptions.default): Files

    Permalink
  100. def listRelativePaths(implicit visitOptions: VisitOptions = File.VisitOptions.default): Iterator[Path]

    Permalink
  101. def loadBytes: Array[Byte]

    Permalink
  102. def md5: String

    Permalink
  103. def moveTo(destination: File, overwrite: Boolean = false): destination.type

    Permalink

    returns

    destination

  104. def moveToDirectory(directory: File)(implicit linkOptions: LinkOptions = File.LinkOptions.default): File

    Permalink

    Moves this file into the given directory

    Moves this file into the given directory

    returns

    the File referencing the new file created under destination

  105. def name: String

    Permalink

    Name of file Certain files may not have a name e.g.

    Name of file Certain files may not have a name e.g. root directory - returns empty string in that case

  106. def nameOption: Option[String]

    Permalink

    Certain files may not have a name e.g.

    Certain files may not have a name e.g. root directory - returns None in that case

  107. def nameWithoutExtension(includeAll: Boolean): String

    Permalink

    includeAll

    For files with multiple extensions e.g. "bundle.tar.gz" nameWithoutExtension(includeAll = true) returns "bundle" nameWithoutExtension(includeAll = false) returns "bundle.tar"

  108. def nameWithoutExtension: String

    Permalink
  109. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  110. def newAsynchronousFileChannel(implicit openOptions: OpenOptions = File.OpenOptions.default): AsynchronousFileChannel

    Permalink
  111. def newBufferedReader(implicit charset: Charset = DefaultCharset): BufferedReader

    Permalink
  112. def newBufferedWriter(implicit charset: Charset = DefaultCharset, openOptions: OpenOptions = File.OpenOptions.default): BufferedWriter

    Permalink
  113. def newDigestInputStream(digest: MessageDigest)(implicit openOptions: OpenOptions = File.OpenOptions.default): DigestInputStream

    Permalink
  114. def newFileChannel(implicit openOptions: OpenOptions = File.OpenOptions.default, attributes: Attributes = File.Attributes.default): FileChannel

    Permalink
  115. def newFileInputStream: FileInputStream

    Permalink
  116. def newFileOutputStream(append: Boolean = false): FileOutputStream

    Permalink
  117. def newFileReader: FileReader

    Permalink
  118. def newFileWriter(append: Boolean = false): FileWriter

    Permalink
  119. def newGzipInputStream(bufferSize: Int = DefaultBufferSize): GZIPInputStream

    Permalink
  120. def newGzipOutputStream(bufferSize: Int = DefaultBufferSize, syncFlush: Boolean = false, append: Boolean = false): GZIPOutputStream

    Permalink
  121. def newInputStream(implicit openOptions: OpenOptions = File.OpenOptions.default): InputStream

    Permalink
  122. def newOutputStream(implicit openOptions: OpenOptions = File.OpenOptions.default): OutputStream

    Permalink
  123. def newPrintWriter(autoFlush: Boolean = false)(implicit openOptions: OpenOptions = File.OpenOptions.default): PrintWriter

    Permalink
  124. def newRandomAccess(mode: RandomAccessMode = File.RandomAccessMode.read): RandomAccessFile

    Permalink
  125. def newScanner(splitter: StringSplitter = StringSplitter.Default)(implicit charset: Charset = DefaultCharset): Scanner

    Permalink
  126. def newWatchService: WatchService

    Permalink
  127. def newZipInputStream(implicit charset: Charset = DefaultCharset): ZipInputStream

    Permalink
  128. def newZipOutputStream(implicit openOptions: OpenOptions = File.OpenOptions.default, charset: Charset = DefaultCharset): ZipOutputStream

    Permalink
  129. def nonEmpty(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink

    returns

    for directories, true if it has no children, false otherwise for files, true if it is a 0-byte file, false otherwise else true if it exists, false otherwise

  130. def notExists(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink
  131. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  132. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  133. def outputStream(implicit openOptions: OpenOptions = File.OpenOptions.default): ManagedResource[OutputStream]

    Permalink
  134. def overwrite(text: String)(implicit openOptions: OpenOptions = File.OpenOptions.default, charset: Charset = DefaultCharset): File.this.type

    Permalink
  135. def owner(implicit linkOptions: LinkOptions = File.LinkOptions.default): UserPrincipal

    Permalink
  136. def ownerName(implicit linkOptions: LinkOptions = File.LinkOptions.default): String

    Permalink
  137. def parent: File

    Permalink

    Return parent of this file NOTE: This API returns null if this file is the root; please use parentOption if you expect to handle roots

    Return parent of this file NOTE: This API returns null if this file is the root; please use parentOption if you expect to handle roots

    See also

    parentOption

  138. def parentOption: Option[File]

    Permalink

    returns

    Some(parent) of this file or None if this is the root and thus has no parent

  139. val path: Path

    Permalink
  140. def pathAsString: String

    Permalink
  141. def pathMatcher(syntax: PathMatcherSyntax, includePath: Boolean)(pattern: String): PathMatcher

    Permalink
  142. def permissions(implicit linkOptions: LinkOptions = File.LinkOptions.default): Set[PosixFilePermission]

    Permalink
  143. def permissionsAsString(implicit linkOptions: LinkOptions = File.LinkOptions.default): String

    Permalink
  144. def posixAttributes(implicit linkOptions: LinkOptions = File.LinkOptions.default): PosixFileAttributes

    Permalink
  145. def printLines(lines: TraversableOnce[_])(implicit openOptions: OpenOptions = File.OpenOptions.append): File.this.type

    Permalink
  146. def printWriter(autoFlush: Boolean = false)(implicit openOptions: OpenOptions = File.OpenOptions.default): ManagedResource[PrintWriter]

    Permalink
  147. def randomAccess(mode: RandomAccessMode = File.RandomAccessMode.read): ManagedResource[RandomAccessFile]

    Permalink
  148. def readDeserialized[A](implicit openOptions: OpenOptions = File.OpenOptions.default): A

    Permalink

    Deserialize a object using Java's default serialization from this file

  149. def register(service: WatchService, events: Events = File.Events.all): File.this.type

    Permalink
  150. def relativize(destination: File): Path

    Permalink
  151. def removePermission(permission: PosixFilePermission)(implicit linkOptions: LinkOptions = File.LinkOptions.default): File.this.type

    Permalink
  152. def renameTo(newName: String): File

    Permalink
  153. def root: File

    Permalink
  154. def scanner(splitter: StringSplitter = StringSplitter.Default)(implicit charset: Charset = DefaultCharset): ManagedResource[Scanner]

    Permalink
  155. def setGroup(group: String): File.this.type

    Permalink
  156. def setOwner(owner: String): File.this.type

    Permalink
  157. def setPermissions(permissions: Set[PosixFilePermission]): File.this.type

    Permalink
  158. def sha1: String

    Permalink
  159. def sha256: String

    Permalink
  160. def sha512: String

    Permalink
  161. def sibling(name: String): File

    Permalink
  162. def siblings: Files

    Permalink
  163. def size(implicit visitOptions: VisitOptions = File.VisitOptions.default): Long

    Permalink

    returns

    file size (for directories, return size of the directory) in bytes

  164. def streamedUnzip(destinationDirectory: File = ...)(implicit charset: Charset = DefaultCharset): destinationDirectory.type

    Permalink

    Streamed unzipping is slightly slower but supports larger files and more encodings

    Streamed unzipping is slightly slower but supports larger files and more encodings

    destinationDirectory

    destination folder; Creates this if it does not exist

    returns

    The destination where contents are unzipped

    See also

    https://github.com/pathikrit/better-files/issues/152

  165. def symbolicLink: Option[File]

    Permalink

    returns

    Some(target) if this is a symbolic link (to target) else None

  166. def symbolicLinkTo(destination: File)(implicit attributes: Attributes = File.Attributes.default): destination.type

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

    Permalink
    Definition Classes
    AnyRef
  168. def testPermission(permission: PosixFilePermission)(implicit linkOptions: LinkOptions = File.LinkOptions.default): Boolean

    Permalink

    test if file has this permission

  169. def toJava: java.io.File

    Permalink
  170. def toString(): String

    Permalink
    Definition Classes
    File → AnyRef → Any
  171. def toTemporary: ManagedResource[File]

    Permalink

    Java's temporary files/directories are not cleaned up by default.

    Java's temporary files/directories are not cleaned up by default. If we explicitly call .deleteOnExit(), it gets added to shutdown handler which is not ideal for long running systems with millions of temporary files as: a) it would slowdown shutdown and b) occupy unnecessary disk-space during app lifetime

    This util auto-deletes the resource when done using the ManagedResource facility

    Example usage: File.temporaryDirectory().foreach(tempDir => doSomething(tempDir)

  172. def tokens(splitter: StringSplitter = StringSplitter.Default)(implicit charset: Charset = DefaultCharset): Iterator[String]

    Permalink
  173. def touch(time: Instant = Instant.now())(implicit attributes: Attributes = File.Attributes.default, linkOptions: LinkOptions = File.LinkOptions.default): File.this.type

    Permalink

    Similar to the UNIX command touch - create this file if it does not exist and set its last modification time

  174. def unGzipTo(destination: File = ..., append: Boolean = false, bufferSize: Int = DefaultBufferSize): destination.type

    Permalink
  175. def unzip(zipFilter: (ZipEntry) ⇒ Boolean = _ => true)(implicit charset: Charset = DefaultCharset): File

    Permalink

    unzip to a temporary zip file

    unzip to a temporary zip file

    returns

    the zip file

  176. def unzipTo(destination: File, zipFilter: (ZipEntry) ⇒ Boolean = _ => true)(implicit charset: Charset = DefaultCharset): destination.type

    Permalink

    Unzips this zip file

    Unzips this zip file

    destination

    destination folder; Creates this if it does not exist

    zipFilter

    An optional param to reject or accept unzipping a file

    returns

    The destination where contents are unzipped

  177. def update(attribute: String, value: Any)(implicit linkOptions: LinkOptions = File.LinkOptions.default): File.this.type

    Permalink

    Set a file attribute e.g.

    Set a file attribute e.g. file("dos:system") = true

  178. def uri: URI

    Permalink
  179. def url: URL

    Permalink
  180. def usingLock[U](mode: RandomAccessMode)(f: (FileChannel) ⇒ U): U

    Permalink
  181. def verifiedExists(implicit linkOptions: LinkOptions = File.LinkOptions.default): Option[Boolean]

    Permalink

    returns

    Some(true) if file is guaranteed to exist Some(false) if file is guaranteed to not exist None if the status is unknown e.g. if file is unreadable

    See also

    https://stackoverflow.com/questions/30520179/why-does-file-exists-return-true-even-though-files-exists-in-the-nio-files

    https://docs.oracle.com/javase/tutorial/essential/io/check.html

  182. final def wait(): Unit

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  185. def walk(maxDepth: Int = Int.MaxValue)(implicit visitOptions: VisitOptions = File.VisitOptions.default): Files

    Permalink

    Walk the directory tree recursively upto maxDepth

    Walk the directory tree recursively upto maxDepth

    returns

    List of children in BFS maxDepth level deep (includes self since self is at depth = 0)

  186. def watchService: ManagedResource[WatchService]

    Permalink
  187. def write(text: String)(implicit openOptions: OpenOptions = File.OpenOptions.default, charset: Charset = DefaultCharset): File.this.type

    Permalink
  188. def writeByteArray(bytes: Array[Byte])(implicit openOptions: OpenOptions = File.OpenOptions.default): File.this.type

    Permalink

    Write byte array to file.

    Write byte array to file. For large contents consider using the writeBytes

    returns

    this

  189. def writeBytes(bytes: Iterator[Byte])(implicit openOptions: OpenOptions = File.OpenOptions.default): File.this.type

    Permalink
  190. def writeSerialized(obj: Serializable)(implicit openOptions: OpenOptions = File.OpenOptions.default): File.this.type

    Permalink

    Serialize a object using Java's serializer into this file

  191. def writeText(text: String)(implicit openOptions: OpenOptions = File.OpenOptions.default, charset: Charset = DefaultCharset): File.this.type

    Permalink
  192. def zip(compressionLevel: Int = Deflater.DEFAULT_COMPRESSION)(implicit charset: Charset = DefaultCharset): File

    Permalink

    zip to a temp directory

    zip to a temp directory

    returns

    the target directory

  193. def zipIn(files: Files, compressionLevel: Int = Deflater.DEFAULT_COMPRESSION)(charset: Charset = DefaultCharset): File.this.type

    Permalink

    Adds these files into this zip file Example usage: File("test.zip").zipIn(Seq(file"hello.txt", file"hello2.txt"))

    Adds these files into this zip file Example usage: File("test.zip").zipIn(Seq(file"hello.txt", file"hello2.txt"))

    returns

    this

  194. def zipInputStream(implicit charset: Charset = DefaultCharset): ManagedResource[ZipInputStream]

    Permalink
  195. def zipOutputStream(implicit openOptions: OpenOptions = File.OpenOptions.default, charset: Charset = DefaultCharset): ManagedResource[ZipOutputStream]

    Permalink
  196. def zipTo(destination: File, compressionLevel: Int = Deflater.DEFAULT_COMPRESSION)(implicit charset: Charset = DefaultCharset): destination.type

    Permalink

    Zips this file (or directory)

    Zips this file (or directory)

    destination

    The destination file; Creates this if it does not exists

    returns

    The destination zip file

Inherited from AnyRef

Inherited from Any

Ungrouped