public class FileManager extends java.lang.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 |
---|---|
java.io.InputStream |
getInputStreamForName(java.lang.String filename)
Returns an
InputStream object corresponding to the provided file name |
java.io.OutputStream |
getOutputStreamForName(java.lang.String filename)
Returns an
OutputStream object corresponding to the provided file name |
java.lang.String |
read(java.lang.String filename)
Read the content of the file specified by the filename.
|
void |
write(java.lang.String filename,
java.lang.String data)
Saves the provided data to the given file.
|
public java.io.InputStream getInputStreamForName(java.lang.String filename) throws java.io.IOException
FileAsStream
InputStream
object corresponding to the provided file namegetInputStreamForName
in interface FileAsStream
filename
- the name of the file to openInputStream
java.io.IOException
- in case of error when opening associated filepublic java.io.OutputStream getOutputStreamForName(java.lang.String filename) throws java.io.IOException
FileAsStream
OutputStream
object corresponding to the provided file namegetOutputStreamForName
in interface FileAsStream
filename
- the name of the file to openOutputStream
java.io.IOException
- in case of error when opening associated filepublic void write(java.lang.String filename, java.lang.String data)
filename
- The path to the filedata
- The data to be writtenpublic java.lang.String read(java.lang.String filename)
filename
- The absolute path to the fileString
. Can be null.