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
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new GrizzledFile(file: File)

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. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. 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

  8. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  9. 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)

  10. 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)

  11. 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.

  12. def dirname: File

    Get the directory name of the file.

    Get the directory name of the file.

    returns

    the directory portion, as a File.

  13. 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.

  14. 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)

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

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

    Definition Classes
    AnyRef → Any
  17. val file: File

  18. def finalize(): Unit

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

    Definition Classes
    AnyRef → Any
  20. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  21. 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

  22. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  23. def listRecursively(topdown: Boolean = true): Stream[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 stream of File objects for everything under the directory.

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

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

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

    Definition Classes
    AnyRef
  27. 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.

  28. 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.

  29. 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.

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

    Definition Classes
    AnyRef
  31. def toString(): String

    Definition Classes
    AnyRef → Any
  32. def touch(time: Long = 1): 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.

  33. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped