grizzled.file

GrizzledFile

final 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: 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
    @throws( ... )
  7. def copyTo(target: File): 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

    the target file

  8. def copyTo(target: String): 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

    the target file

  9. def deleteRecursively(): Either[String, 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

    Left(error) or Right(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
  18. def hashCode(): Int

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

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

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

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

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

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

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

    Definition Classes
    AnyRef
  28. def toString(): String

    Definition Classes
    AnyRef → Any
  29. def touch(time: Long = 1): Either[String, 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.

  30. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. def walk(topdown: Boolean = true): List[(String, List[String], List[String])]

    Directory tree lister, adapted from Python's os.walk() function.

    Directory tree lister, adapted from Python's os.walk() function. NOTE: This function generates the entire directory tree in memory, before returning. If you want a lazy generator, with optional filtering, use the listRecursively() method.

    For each directory in the directory tree rooted at this object (including the directory itself, but excluding '.' and '..'), yields a 3-tuple.

    dirpath, dirnames, filenames

    dirpath is a string, the path to the directory. dirnamesis a list of the names of the subdirectories in dirpath (excluding '.' and '..'). filenames is a list of the names of the non-directory files in dirpath. Note that the names in the lists are just names, with no path components. To get a full path (which begins with this directory) to a file or directory in dirpath, use dirpath + java.io.fileSeparator + name, or use grizzled.file.util.joinPath().

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

    WARNING! This method does not grok symbolic links!

    topdown

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

    returns

    List of triplets, as described above.

Inherited from AnyRef

Inherited from Any

Ungrouped