FileRepository

play.doc.FileRepository

Repository for loading files

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def findFileWithName(name: String): Option[String]

Find a file with the given name. The repositories directory structure is searched, and the path of the first file found with that name is returned.

Find a file with the given name. The repositories directory structure is searched, and the path of the first file found with that name is returned.

Value parameters

name

The name of the file to find

Attributes

Returns

The path of the file, or None if it couldn't be found

def handleFile[A](path: String)(handler: FileHandle => A): Option[A]

Load a file using the given handler. If the file is found then the file will be opened and handler will be called with the file's handle. The handler must call the close method on the handle to ensure that the file is closed properly.

Load a file using the given handler. If the file is found then the file will be opened and handler will be called with the file's handle. The handler must call the close method on the handle to ensure that the file is closed properly.

Value parameters

handler

The handler to handle the file

path

The path of the file to load

Attributes

Returns

The file, as loaded by the loader, or None if the doesn't exist

def loadFile[A](path: String)(loader: InputStream => A): Option[A]

Load a file using the given loader. If the file is found then the file will be opened and loader will be called with its content. The file will be closed automatically when loader returns a value or throws an exception.

Load a file using the given loader. If the file is found then the file will be opened and loader will be called with its content. The file will be closed automatically when loader returns a value or throws an exception.

Value parameters

loader

The loader to load the file

path

The path of the file to load

Attributes

Returns

The file, as loaded by the loader, or None if the doesn't exist