Packages

  • package root
    Definition Classes
    root
  • package grizzled

    The Grizzled Scala Library contains a variety of miscellaneous, general purpose utility classes and objects.

    The Grizzled Scala Library contains a variety of miscellaneous, general purpose utility classes and objects.

    The home page for the Grizzled Scala Library is http://software.clapper.org/grizzled-scala/. Please see that page for complete details, including installation instructions.

    Definition Classes
    root
  • package file

    File-related classes and utilities.

    File-related classes and utilities. This package is distinguished from the grizzled.io package in that this package operates on files and paths, not on open streams or sources.

    Definition Classes
    grizzled
    See also

    grizzled.io

  • object Implicits

    Enrichment classes for File objects and the like.

    Enrichment classes for File objects and the like.

    Definition Classes
    file
  • GrizzledFile
c

grizzled.file.Implicits

GrizzledFile

implicit class GrizzledFile extends AnyRef

A wrapper for java.io.File that provides additional methods. By importing the implicit conversion functions, you can use the methods in this class transparently from a java.io.File object.

import grizzled.file.GrizzledFile._

val file = new File("/tmp/foo/bar")
println(file.split) // prints: List(/tmp, foo, bar)
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. GrizzledFile
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new GrizzledFile(file: File)

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def basename: File

    Get the basename (file name only) part of a path.

    Get the basename (file name only) part of a path.

    returns

    the file name portion, as a File

  6. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )
  7. def copyTo(target: File): Try[File]

    Copy the file to a target directory or file.

    Copy the file to a target directory or file.

    target

    path to the target file or directory

    returns

    A Success containing the target file, or Failure(exception)

  8. def copyTo(target: String): Try[File]

    Copy the file to a target directory or file.

    Copy the file to a target directory or file.

    target

    path to the target file or directory

    returns

    A Success containing the target file, or Failure(exception)

  9. def deleteRecursively(): Try[Int]

    Recursively remove the directory specified by this object.

    Recursively remove the directory specified by this object. This method is conceptually equivalent to rm -r on a Unix system.

    returns

    Failure(exception) or Success(total), where total is the number of files and directories actually deleted.

  10. def dirname: File

    Get the directory name of the file.

    Get the directory name of the file.

    returns

    the directory portion, as a File.

  11. def dirnameBasename: (File, File)

    Split the file's path into directory (dirname) and file (basename) components.

    Split the file's path into directory (dirname) and file (basename) components. Analogous to Python's os.path.pathsplit() function.

    returns

    a (dirname, basename) tuple of File objects.

  12. def dirnameBasenameExtension: (File, String, String)

    Split this file's pathname into the directory name, basename, and extension pieces.

    Split this file's pathname into the directory name, basename, and extension pieces.

    returns

    a 3-tuple of (dirname, basename, extension)

  13. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  14. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  15. val file: File
  16. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  17. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  18. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  19. def isEmpty: Boolean

    Determine whether a directory is empty.

    Determine whether a directory is empty. Only meaningful for a directory.

    returns

    true if the directory is empty, false if not

  20. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  21. def listRecursively(topdown: Boolean = true): LazyList[File]

    List a directory recursively, returning File objects for each file (and subdirectory) found.

    List a directory recursively, returning File objects for each file (and subdirectory) found. This method does lazy evaluation, instead of calculating everything up-front, as walk() does.

    If topdown is true, a directory is generated before the entries for any of its subdirectories (directories are generated top down). If topdown is false, a directory directory is generated after the entries for all of its subdirectories (directories are generated bottom up).

    topdown

    true to do a top-down traversal, false otherwise.

    returns

    a lazy sequence of File objects for everything under the directory. This sequence will be a LazyList (typedef'd) in Scala 2.13 or better, and a Stream in Scala 2.12 and older.

  22. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  23. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  25. def pathExists: Try[Boolean]

    A version of java.io.File.exists that returns a Try, this method tests the existence of the file.

    A version of java.io.File.exists that returns a Try, this method tests the existence of the file.

    returns

    Success(true) if the file exists, and Failure(FileDoesNotExistException) if it does not.

  26. def relativePath(relativeTo: File): String

    Get the path of this file, relative to some other file.

    Get the path of this file, relative to some other file.

    relativeTo

    the other file

    returns

    the path of this file, relative to the other file.

  27. def split: List[String]

    Split this file's path into its constituent components.

    Split this file's path into its constituent components. If the path is absolute, the first piece will have a file separator in the beginning. Examples:

    Input Output
    "" List("")
    "/" List("/")
    "foo" List("foo")
    "foo/bar" List("foo", "bar")
    "." List(".")
    "../foo" List("..", "foo")
    "./foo" List(".", "foo")
    "/foo/bar/baz" List("/foo", "bar", "baz")
    "foo/bar/baz" List("foo", "bar", "baz")
    "/foo" List("/foo")

    returns

    the component pieces.

  28. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  29. def toString(): String
    Definition Classes
    AnyRef → Any
  30. def touch(time: Long = -1l): Try[Boolean]

    Similar to the Unix touch command, this function:

    Similar to the Unix touch command, this function:

    • updates the access and modification time for the path represented by this object
    • creates the path (as a file), if it does not exist

    If the file corresponds to an existing directory, this method will return an error.

    time

    Set the last-modified time to this time, or to the current time if this parameter is negative.

    returns

    Success(true) on success, Failure(exception) on error.

  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped