org.specs.matcher.FileMatchers

trait FileMatchers

trait FileMatchers

 extends PathMatchers


The FileMatchers trait provides matchers which are applicable to files


Source: FileMatchers.scala(110)

Direct Known Subclasses

Matchers,

Nested Classes

Path,

 Methods

!= final def !=(arg0 : Any) Boolean Any
!= final def !=(arg0 : Object) Boolean AnyRef
== final def ==(arg0 : Object) Boolean AnyRef
== final def ==(arg0 : Any) Boolean Any
asInstanceOf final def asInstanceOf[T0] T0 Any
asPath implicit def asPath(p : String)
transforms a string as a Path object to allow matches like: "c:/projects" [details]
path must exist
Path
beADirectoryPath def beADirectoryPath[T <: String]
Matches if new File(path) [details]
isDirectory
Matcher[T] PathMatchers
beAFilePath def beAFilePath[T <: String]
Matches if new File(path) [details]
isFile
Matcher[T] PathMatchers
beAHiddenPath def beAHiddenPath[T <: String]
Matches if new File(path) [details]
isHidden
Matcher[T] PathMatchers
beAReadablePath def beAReadablePath[T <: String]
Matches if new File(path) [details]
canRead
Matcher[T] PathMatchers
beAWritablePath def beAWritablePath[T <: String]
Matches if new File(path) [details]
canWrite
Matcher[T] PathMatchers
beAbsolute def beAbsolute[T <: Object]
Matches if file [details]
isAbsolute
Matcher[T]
beAnAbsolutePath def beAnAbsolutePath[T <: String]
Matches if new File(path) [details]
isAbsolute
Matcher[T] PathMatchers
beAnExistingPath def beAnExistingPath[T <: String]
Matches if new File(path) [details]
exists
Matcher[T] PathMatchers
beDirectory def beDirectory[T <: Object]
Matches if file [details]
isDirectory
Matcher[T]
beEqualIgnoringSep def beEqualIgnoringSep[T <: String](other : String)
Matches if 2 paths are the same regardless of their separators [details]
deprecated
- use beEqualToIgnoringSep instead
Matcher[Nothing] PathMatchers
beEqualToIgnoringSep def beEqualToIgnoringSep[T <: String](other : String)
Matches if 2 paths are the same regardless of their separators
Matcher[T] PathMatchers
beFile def beFile[T <: Object]
Matches if file [details]
isFile
Matcher[T]
beHidden def beHidden[T <: Object]
Matches if file [details]
isHidden
Matcher[T]
beReadable def beReadable[T <: Object]
Matches if file [details]
canRead
Matcher[T]
beWritable def beWritable[T <: Object]
Matches if file [details]
canWrite
Matcher[T]
canRead def canRead(path : String)
[details]
return
- true if the file can be read
Boolean FileSystem
canWrite def canWrite(path : String)
[details]
return
- true if the file can be written
Boolean FileSystem
clone protected def clone Object AnyRef
copy def copy(input : InputStream, output : OutputStream)
Copy an input stream to an output stream [details]
param
output - output stream
input - input stream
Unit FileSystem
copyDir def copyDir(url : URL, dest : String, tagged : Tagged)
copy the content of a directory to another [details]
param
excluded - names for excluded files
dest - destination directory path
included - names for included files
url - url of the directory to copy
Unit FileSystem
copyDir def copyDir(src : String, dest : String, tagged : Tagged)
copy the content of a directory to another [details]
param
excluded - names for excluded files
dest - destination directory path
included - names for included files
path - path of the directory to copy
Unit FileSystem
copyDir def copyDir(url : URL, dest : String)
copy the content of a directory to another [details]
param
dest - destination directory path
url - url of the directory to copy
Unit FileSystem
copyDir def copyDir(src : String, dest : String)
copy the content of a directory to another [details]
param
dest - destination directory path
path - path of the directory to copy
Unit FileSystem
copyFile def copyFile(path : String, dest : String)
Copy the content of a directory to another [details]
param
dest - destination directory path
path - path of the file to copy
Unit FileSystem
copySpecResourcesDir def copySpecResourcesDir(src : String, outputDir : String)
Copy specs resources found either in the specs jar or in the classpath directories to an output directory [details]
Current limitations!! This only works if the jar holding the resources contains the word "specs".
param
outputDir - output directory where to copy the files to
src - name of the resource directory to copy
Unit FileSystem
createDir def createDir(path : String)
creates a directory for a given path
Boolean FileSystem
createFile def createFile(path : String)
creates a file for a given path [details]
Create the parent directory if necessary.
Unit FileWriter
eq final def eq(arg0 : Object) Boolean AnyRef
equals def equals(arg0 : Any) Boolean AnyRef
exist def exist[T <: Object]
Matches if file [details]
exists
Matcher[T]
existPath def existPath[T <: String]
alias for beAnExistingFile
Matcher[T] PathMatchers
exists def exists(path : String)
[details]
return
- true if the file exists
Boolean FileSystem
filePaths def filePaths(path : String)
[details]
param
path - glob expression, for example: ./dir*.xml
return
- the list of paths represented by the "glob" definition path
List[String] FileSystem
finalize protected def finalize Unit AnyRef
getAbsolutePath def getAbsolutePath(path : String)
[details]
return
- the file absolute path
String FileSystem
getCanonicalPath def getCanonicalPath(path : String)
[details]
return
- the file canonical path
String FileSystem
getClass final def getClass Class[Object] AnyRef
getName def getName(path : String)
[details]
return
- the file name
String FileSystem
getParent def getParent(path : String)
[details]
return
- the file parent path
String FileSystem
getResourcesNamed def getResourcesNamed(name : String)
Return urls of the resources containing the name "name" from this ClassLoader and the System classLoader [details]
param
name - name of the resource to find
return
- a list of URL
List[URL] FileSystem
getWriter def getWriter(path : String)
The getWriter function can be overriden to provide a mock writer writing to the console for example [details]
return
- a Writer object opened on the file designated by path
Writer FileWriter
globToPattern def globToPattern(glob : String)
[details]
return
- the regular expression equivalent to a glob pattern (see the specs for examples)
String FileSystem
hashCode def hashCode Int AnyRef
haveAbsolutePath def haveAbsolutePath[T <: Object](path : String)
Matches if file [details]
getAbsolutePath == path
Matcher[T]
haveAsAbsolutePath def haveAsAbsolutePath[T <: String](absolutePath : String)
Matches if new File(path) [details]
getAbsolutePath == absolutePath
Matcher[T] PathMatchers
haveAsCanonicalPath def haveAsCanonicalPath[T <: String](canonicalPath : String)
Matches if new File(path) [details]
getCanonicalPath == canonicalPath
Matcher[T] PathMatchers
haveCanonicalPath def haveCanonicalPath[T <: Object](path : String)
Matches if file [details]
getCanonicalPath == path
Matcher[T]
haveList def haveList[T <: Object](list : String)
Matches if file [details]
list == list
Matcher[T]
haveName def haveName[T <: Object](name : String)
Matches if file [details]
getName == name
Matcher[T]
haveParent def haveParent[T <: Object](path : String)
Matches if file [details]
getParent == path
Matcher[T]
haveParentPath def haveParentPath[T <: String](parent : String)
Matches if new File(path) [details]
getParent == parent
Matcher[T] PathMatchers
havePathName def havePathName[T <: String](name : String)
Matches if new File(path) [details]
getName == name
Matcher[T] PathMatchers
isAbsolute def isAbsolute(path : String)
[details]
return
- true if the file is absolute
Boolean FileSystem
isDir def isDir(path : String)
[details]
return
- true if the File represented by this path is a directory
Boolean FileSystem
isDirectory def isDirectory(path : String)
[details]
return
- true if the file is a directory
Boolean FileSystem
isEqualIgnoringSep def isEqualIgnoringSep[T <: String](path : T, other : String)
[details]
return
- true if the 2 paths are equal, ignoring separators
Boolean PathMatchers
isFile def isFile(path : String)
[details]
return
- true if the file is a file
Boolean FileSystem
isHidden def isHidden(path : String)
[details]
return
- true if the file is hidden
Boolean FileSystem
isInstanceOf final def isInstanceOf[T0] Boolean Any
listFiles def listFiles(path : String)
[details]
return
- the files of that directory
List[String] FileSystem
listPaths def listPaths[T <: String](list : String*)
Matches if new File(path) [details]
list == list(files)
Matcher[T] PathMatchers
mkdirs def mkdirs(path : String)
creates a new directory
Boolean FileWriter
ne final def ne(arg0 : Object) Boolean AnyRef
notify final def notify Unit AnyRef
notifyAll final def notifyAll Unit AnyRef
readFile def readFile(path : String)
reads the content of a file [details]
param
path - the path of the file to read
return
- the content of the file at path
String FileReader
removeDir def removeDir(path : String)
deletes the directory and all directory contents at the specified path and return the parent path of that directory
String FileSystem
synchronized final def synchronized[T0](arg0 : T0) T0 AnyRef
toString def toString String AnyRef
unjar def unjar(path : String, dest : String)
Unjar the jar (or zip file) specified by "path" to the "dest" directory [details]
param
dest - destination directory path
path - path of the jar file
Unit FileSystem
unjar def unjar(path : String, dirPath : String, regexFilter : String)
Unjar the jar (or zip file) specified by "path" to the "dest" directory [details]
Filters files which shouldn't be extracted with a regular expression.
param
dest - destination directory path
regexFilter - regular expression filtering files which shouldn't be extracted
path - path of the jar file
Unit FileSystem
wait final def wait Unit AnyRef
wait final def wait(arg0 : Long) Unit AnyRef
wait final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
write def write(path : String)(function : (Writer) => Unit)
writes some content to a file and take care of closing the file [details]

Usage:

   write("./dir/hello.txt") { out =>
     out.write("content")
   }
   
param
path - path of the file to write
Unit FileWriter
writeFile def writeFile(path : String, content : => String)
writes some content to a file [details]
param
path - path of the file to read @content content of the file to write
Unit FileWriter
Copyright (c) 2007-2009. All Rights Reserved.