public class FileDataSource extends java.lang.Object implements IODataSource
IODataSource
that can read from and write to a file.
Attention: it is advised not to use this class directly, but rather construct it by creating a
FileClient
and build the FileDataSource with the FileClient.createFileDataSource()
method.
Constructor and Description |
---|
FileDataSource(java.io.File file)
Create a new FileDataSource instance.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
getFile()
Returns the file that this data source is mapped to.
|
java.io.InputStream |
getInputStream()
Returns an InputStream that is able to read data from the file that was passed in when
constructing the FileDataSource.
|
java.io.OutputStream |
getOutputStream()
Returns an OutputStream that is able to write data to the file that was passed in when
constructing the FileDataSource.
|
public FileDataSource(java.io.File file)
file
- the file to use for reading the data from from or writing the data topublic java.io.File getFile()
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface InputDataSource
java.io.IOException
- when the InputStream on the file could not be createdpublic java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface OutputDataSource
java.io.IOException
- when the OutputStream on the file could not be created