|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectuk.ac.starlink.util.DataSource
uk.ac.starlink.util.FileDataSource
public class FileDataSource
A DataSource implementation based on a File.
| Field Summary |
|---|
| Fields inherited from class uk.ac.starlink.util.DataSource |
|---|
DEFAULT_INTRO_LIMIT, MARK_WORKAROUND_PROPERTY |
| Constructor Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class uk.ac.starlink.util.DataSource |
|---|
close, forceCompression, getCompression, getHybridInputStream, getInputStream, getInputStream, getIntro, getIntroLimit, getLength, getMarkWorkaround, getName, getPosition, getSystemId, makeDataSource, makeDataSource, makeDataSource, setCompression, setIntroLimit, setMarkWorkaround, setName, setPosition, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public 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 directory
public FileDataSource(java.io.File file)
throws java.io.IOException
file - the file
java.io.IOException - if file does not exist, cannot be read,
or is a directory
public FileDataSource(java.lang.String filename)
throws java.io.IOException
filename - filename
java.io.IOException - if filename does not name a readable file| Method Detail |
|---|
protected java.io.InputStream getRawInputStream()
throws java.io.IOException
DataSource
getRawInputStream in class DataSourcejava.io.IOExceptionpublic long getRawLength()
getRawLength in class DataSourcepublic java.io.File getFile()
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 DataSource
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||