public class FileDataSource extends DataSource
File
.DEFAULT_INTRO_LIMIT, MARK_WORKAROUND_PROPERTY
Constructor and Description |
---|
FileDataSource(File file)
Creates a new FileDataSource from a File object.
|
FileDataSource(File file,
String position)
Creates a new FileDataSource from a File object and a position string.
|
FileDataSource(String filename)
Creates a new FileDataSource from a filename.
|
Modifier and Type | Method and Description |
---|---|
File |
getFile()
Returns the File object on which this
FileDataSource
is based. |
protected InputStream |
getRawInputStream()
Provides a new InputStream for this data source.
|
long |
getRawLength()
Returns the length of this file.
|
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, toString
public FileDataSource(File file, String position) throws IOException
file
- the fileposition
- the source's position attribute
(indicates the relevant part of the file)IOException
- if file
does not exist,
cannot be read, or is a directorypublic FileDataSource(File file) throws IOException
file
- the fileIOException
- if file
does not exist,
cannot be read, or is a directorypublic FileDataSource(String filename) throws IOException
filename
- filenameIOException
- if filename
does not name
a readable fileprotected InputStream getRawInputStream() throws IOException
DataSource
getRawInputStream
in class DataSource
IOException
public long getRawLength()
getRawLength
in class DataSource
public File getFile()
FileDataSource
is based.public URL getURL()
DataSource
URL.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 DataSource
null
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.