public class FileDataSource extends DataSource
File.DEFAULT_INTRO_LIMIT, MARK_WORKAROUND_PROPERTY| Constructor and Description |
|---|
FileDataSource(java.io.File file)
Creates a new FileDataSource from a File object.
|
FileDataSource(java.io.File file,
java.lang.String position)
Creates a new FileDataSource from a File object and a position string.
|
FileDataSource(java.lang.String filename)
Creates a new FileDataSource from a filename.
|
| Modifier and Type | Method and Description |
|---|---|
java.io.File |
getFile()
Returns the File object on which this
FileDataSource
is based. |
protected java.io.InputStream |
getRawInputStream()
Provides a new InputStream for this data source.
|
long |
getRawLength()
Returns the length of this file.
|
java.net.URL |
getURL()
Returns a URL which corresponds to this data source, if one exists.
|
close, forceCompression, getCompression, getHybridInputStream, getInputStream, getInputStream, getIntro, getIntroLimit, getLength, getMarkWorkaround, getName, getPosition, getSystemId, makeDataSource, makeDataSource, makeDataSource, setCompression, setIntroLimit, setMarkWorkaround, setName, setPosition, toStringpublic FileDataSource(java.io.File file,
java.lang.String position)
throws java.io.IOException
file - the fileposition - the source's position attribute
(indicates the relevant part of the file)java.io.IOException - if file does not exist,
cannot be read, or is a directorypublic FileDataSource(java.io.File file)
throws java.io.IOException
file - the filejava.io.IOException - if file does not exist,
cannot be read, or is a directorypublic FileDataSource(java.lang.String filename)
throws java.io.IOException
filename - filenamejava.io.IOException - if filename does not name
a readable fileprotected java.io.InputStream getRawInputStream()
throws java.io.IOException
DataSourcegetRawInputStream in class DataSourcejava.io.IOExceptionpublic long getRawLength()
getRawLength in class DataSourcepublic java.io.File getFile()
FileDataSource
is based.public java.net.URL getURL()
DataSourceURL.openConnection() method call on the URL
returned by this method should provide a stream with the
same content as the DataSource.getRawInputStream() method of this
data source. If no such URL exists or is known, then null
should be returned.
If this source has a non-null position value, it will be appended to the main part of the URL after a '#' character (as the URL's ref part).
getURL in class DataSourcenull