Package ch.epfl.cs107.play.io
Class FolderFileSystem
java.lang.Object
ch.epfl.cs107.play.io.FolderFileSystem
- All Implemented Interfaces:
FileSystem
Implementation of file system, mirroring actual files on disk.
-
Constructor Summary
ConstructorsConstructorDescriptionFolderFileSystem(FileSystem fallback) Creates a new file system using current working directory.FolderFileSystem(FileSystem fallback, File folder) Creates a new file system using specified folder. -
Method Summary
Modifier and TypeMethodDescriptionOpen an existing file for read.Open file for write, previous content overwritten if any.
-
Constructor Details
-
FolderFileSystem
Creates a new file system using specified folder.- Parameters:
fallback- (FileSystem): secondary file system used on error, not nullfolder- (File): root, may be null
-
FolderFileSystem
Creates a new file system using current working directory.- 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
-