Package ch.epfl.cs107.play.io
Class ResourceFileSystem
java.lang.Object
ch.epfl.cs107.play.io.ResourceFileSystem
- All Implemented Interfaces:
FileSystem
Read-only implementation of file system, using native resources bundled with binaries.
-
Constructor Summary
ConstructorsConstructorDescriptionResourceFileSystem(FileSystem fallback) Creates a new resource file system using core binaires.ResourceFileSystem(FileSystem fallback, ClassLoader loader) Creates a new resource file system using specified binaries. -
Method Summary
Modifier and TypeMethodDescriptionOpen an existing file for read.Open file for write, previous content overwritten if any.
-
Constructor Details
-
ResourceFileSystem
Creates a new resource file system using specified binaries.- Parameters:
fallback- (FileSystem): secondary file system used on error, not nullloader- (ClassLoader): specific binary to use, not null
-
ResourceFileSystem
Creates a new resource file system using core binaires.- Parameters:
fallback- (FileSystem): secondary file system used on error, not null
-
-
Method Details
-
read
Description copied from interface:FileSystemOpen an existing file for read.- Specified by:
readin interfaceFileSystem- Parameters:
name- (String): unique identifier, not null- Returns:
- (InputStream): content stream, not null
- Throws:
IOException- if file cannot be open for read
-
write
Description copied from interface:FileSystemOpen file for write, previous content overwritten if any.- Specified by:
writein interfaceFileSystem- Parameters:
name- (String): unique identifier, not null- Returns:
- (InputStream): content stream, not null
- Throws:
IOException- if file cannot be open for write
-