FileSystem

org.specs2.io.FileSystem
See theFileSystem companion object
trait FileSystem extends FilePathReader

Interface for the FileSystem where effects are denoted with the "Operation" type

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object FileSystem.type

Members list

Value members

Concrete methods

def copyDir(src: DirectoryPath, dest: DirectoryPath): Operation[Unit]

copy the content of a directory to another.

copy the content of a directory to another.

Value parameters

dest

destination directory path

src

path of the directory to copy

Attributes

def copyFile(dest: DirectoryPath)(filePath: FilePath): Operation[Unit]

copy a file to a destination directory

copy a file to a destination directory

Value parameters

dest

destination directory path

filePath

path of the file to copy

Attributes

def createFile(filePath: FilePath): Operation[Boolean]

create a new file

create a new file

Attributes

def delete(file: FilePath): Operation[Unit]

delete files or directories

delete files or directories

Attributes

def delete(dir: DirectoryPath): Operation[Unit]

delete a directory

delete a directory

Attributes

def deleteFile(filePath: FilePath): Operation[Boolean]

delete a file

delete a file

Attributes

def mkdirs(path: DirectoryPath): Operation[Unit]

create a directory and its parent directories

create a directory and its parent directories

Attributes

def mkdirs(path: FilePath): Operation[Unit]

create a the directory containing a file and its parent directories

create a the directory containing a file and its parent directories

Attributes

def replaceInFile(filePath: FilePath, source: String, target: String): Operation[Unit]

replace a string in a file

replace a string in a file

Attributes

def unjar(jarUrl: URL, dest: DirectoryPath, regexFilter: String): Operation[Unit]

Unjar the jar (or zip file) specified by "path" to the "dest" directory. Filters files which shouldn't be extracted with a regular expression.

Unjar the jar (or zip file) specified by "path" to the "dest" directory. Filters files which shouldn't be extracted with a regular expression.

Value parameters

dest

destination directory path

jarUrl

path of the jar file

regexFilter

regular expression filtering files which shouldn't be extracted; the expression must capture the path of an entry as group 1 which will then be used relative to dirPath as target path for that entry

Attributes

def updateFileContent(filePath: FilePath)(update: String => String): Operation[Unit]

modify the content of a file

modify the content of a file

Attributes

def withEphemeralFile(path: FilePath)(operation: Operation[Unit]): Operation[Unit]

execute an operation with a File, then delete it

execute an operation with a File, then delete it

Attributes

def writeFile(filePath: FilePath, content: String): Operation[Unit]

write a string to a file as UTF-8

write a string to a file as UTF-8

Attributes

Inherited methods

def doesNotExist(directoryPath: DirectoryPath): Operation[Boolean]

Attributes

Returns

true if the directory doesn't exist

Inherited from:
FilePathReader
def doesNotExist(filePath: FilePath): Operation[Boolean]

Attributes

Returns

true if the file doesn't exist

Inherited from:
FilePathReader
def exists(directoryPath: DirectoryPath): Operation[Boolean]

Attributes

Returns

true if the directory exists

Inherited from:
FilePathReader
def exists(filePath: FilePath): Operation[Boolean]

Attributes

Returns

true if the file exists

Inherited from:
FilePathReader
def filePaths(dir: DirectoryPath, glob: String, verbose: Boolean): Operation[List[FilePath]]

Attributes

Returns

the list of file paths accessible from dir

Inherited from:
FilePathReader
def filterWithPattern(pattern: String): FilePath => Boolean

filter files according to a regex pattern

filter files according to a regex pattern

Attributes

Inherited from:
FilePathReader
def globToPattern(glob: String): String

Attributes

Returns

the regular expression equivalent to a glob pattern (see the specs for Fragments)

Inherited from:
FilePathReader

Attributes

Returns

the files directly accessible from a directory

Inherited from:
FilePathReader
def listDirectFilePaths(directory: DirectoryPath): Operation[IndexedSeq[FilePath]]

Attributes

Returns

the files directly accessible from a directory

Inherited from:
FilePathReader
def listFilePaths(directory: DirectoryPath): Operation[List[FilePath]]

Attributes

Returns

the files accessible recursively from a directory

Inherited from:
FilePathReader
def md5(filePath: FilePath): Operation[String]

Attributes

Returns

the MD5 hash of a file

Inherited from:
FilePathReader
def mustBeADirectory(file: File): Operation[Unit]

succeeds if the file is a directory

succeeds if the file is a directory

Attributes

Inherited from:
FilePathReader
def mustExist(file: File): Operation[Unit]

succeeds if the file exists

succeeds if the file exists

Attributes

Inherited from:
FilePathReader
def mustNotBeADirectory(file: File): Operation[Unit]

succeeds if the file is not a directory

succeeds if the file is not a directory

Attributes

Inherited from:
FilePathReader
def readBytes(filePath: FilePath): Operation[Array[Byte]]

read the content of a file as an Array of Bytes

read the content of a file as an Array of Bytes

Attributes

Inherited from:
FilePathReader
def readFile(path: FilePath): Operation[String]

Attributes

Returns

the content of a file encoded as UTF8

Inherited from:
FilePathReader
def readFileWithCodec(path: FilePath, codec: Codec): Operation[String]

Attributes

Returns

the content of a file with a specific codec

Inherited from:
FilePathReader
def readLines(filePath: FilePath): Operation[IndexedSeq[String]]

Attributes

Returns

the content of a file as UTF-8 lines

Inherited from:
FilePathReader
def readLinesWithCodec(filePath: FilePath, codec: Codec): Operation[IndexedSeq[String]]

Attributes

Returns

the content of a file with a specific codec

Inherited from:
FilePathReader