|
|||||||||
| 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(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. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class uk.ac.starlink.util.DataSource |
|---|
close, forceCompression, getCompression, getHybridInputStream, getInputStream, getInputStream, getIntro, getIntroLimit, getLength, getMarkWorkaround, getName, getPosition, getSystemId, 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(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 directory
public FileDataSource(File file)
throws IOException
file - the file
IOException - if file does not exist, cannot be read,
or is a directory
public FileDataSource(String filename)
throws IOException
filename - filename
IOException - if filename does not name a readable file| Method Detail |
|---|
protected InputStream getRawInputStream()
throws IOException
DataSource
getRawInputStream in class DataSourceIOExceptionpublic long getRawLength()
getRawLength in class DataSourcepublic File getFile()
public 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
|
Copyright © 2004 CLRC: Central Laboratory of the Research Councils. All rights reserved. | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||