Package uk.ac.starlink.util
Class URLDataSource
java.lang.Object
uk.ac.starlink.util.DataSource
uk.ac.starlink.util.URLDataSource
A DataSource implementation based on a
URL
.
This uses an AuthManager
to manage authentication and redirects.
- Author:
- Mark Taylor (Starlink), Peter W. Draper (JAC, Durham University)
-
Field Summary
Fields inherited from class uk.ac.starlink.util.DataSource
DEFAULT_INTRO_LIMIT, MARK_WORKAROUND_PROPERTY
-
Constructor Summary
ConstructorsConstructorDescriptionURLDataSource
(URL url) Constructs a DataSource from a URL with default content coding and AuthManager.URLDataSource
(URL url, ContentCoding coding) Constructs a DataSource from a URL with given content coding policy.URLDataSource
(URL url, ContentCoding coding, uk.ac.starlink.auth.AuthManager authManager) Constructs a DataSource from a URL with given content coding policy and AuthManager. -
Method Summary
Modifier and TypeMethodDescriptionprotected InputStream
Provides a new InputStream for this data source.getURL()
Returns the URL on which thisURLDataSource
is based.Methods inherited from class uk.ac.starlink.util.DataSource
close, forceCompression, getCompression, getHybridInputStream, getInputStream, getInputStream, getIntro, getIntroLimit, getLength, getMarkWorkaround, getName, getPosition, getRawLength, getSystemId, makeDataSource, makeDataSource, makeDataSource, setCompression, setIntroLimit, setMarkWorkaround, setName, setPosition, toString
-
Constructor Details
-
URLDataSource
Constructs a DataSource from a URL with default content coding and AuthManager. If the URL has a ref part (the bit after the '#') it will be treated as the position attribute of this DataSource.- Parameters:
url
- URL
-
URLDataSource
Constructs a DataSource from a URL with given content coding policy. If the URL has a ref part (the bit after the '#') it will be treated as the position attribute of this DataSource.- Parameters:
url
- URLcoding
- configures HTTP compression; may be overridden if inapplicable or security concerns apply
-
URLDataSource
Constructs a DataSource from a URL with given content coding policy and AuthManager. If the URL has a ref part (the bit after the '#') it will be treated as the position attribute of this DataSource.- Parameters:
url
- URLcoding
- configures HTTP compression; may be overridden if inapplicable or security concerns applyauthManager
- authentication manager
-
-
Method Details
-
getRawInputStream
Description copied from class:DataSource
Provides a new InputStream for this data source. This method should be implemented by subclasses to provide a new InputStream giving the raw content of the source each time it is called. The general contract of this method is that each time it is called it will return a stream with the same content.- Specified by:
getRawInputStream
in classDataSource
- Returns:
- an InputStream containing the data of this source
- Throws:
IOException
-
getURL
Returns the URL on which thisURLDataSource
is based.- Overrides:
getURL
in classDataSource
- Returns:
- the URL
-