public class FileManager extends Object implements FileAsStream
FileManager
provides the following methods:
read(String)
: reads the content of a filewrite(String, String)
: writes some data in a fileConstructor and Description |
---|
FileManager() |
Modifier and Type | Method and Description |
---|---|
InputStream |
getInputStreamForName(String filename)
Returns an
InputStream object corresponding to the provided file name |
OutputStream |
getOutputStreamForName(String filename)
Returns an
OutputStream object corresponding to the provided file name |
String |
read(String filename)
Read the content of the file specified by the filename.
|
void |
write(String filename,
String data)
Saves the provided data to the given file.
|
public InputStream getInputStreamForName(String filename) throws IOException
FileAsStream
InputStream
object corresponding to the provided file namegetInputStreamForName
in interface FileAsStream
filename
- the name of the file to openInputStream
IOException
- in case of error when opening associated filepublic OutputStream getOutputStreamForName(String filename) throws IOException
FileAsStream
OutputStream
object corresponding to the provided file namegetOutputStreamForName
in interface FileAsStream
filename
- the name of the file to openOutputStream
IOException
- in case of error when opening associated filepublic void write(String filename, String data)
filename
- The path to the filedata
- The data to be written