Class URLDataSource


  • public class URLDataSource
    extends DataSource
    A DataSource implementation based on a URL.
    Author:
    Mark Taylor (Starlink), Peter W. Draper (JAC, Durham University)
    • Constructor Detail

      • URLDataSource

        public URLDataSource​(java.net.URL url)
        Constructs a DataSource from a URL with default content coding. 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

        public URLDataSource​(java.net.URL url,
                             ContentCoding coding)
        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 - URL
        coding - configures HTTP compression; may be overridden if inapplicable or security concerns apply
    • Method Detail

      • getRawInputStream

        protected java.io.InputStream getRawInputStream()
                                                 throws java.io.IOException
        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 class DataSource
        Returns:
        an InputStream containing the data of this source
        Throws:
        java.io.IOException
      • getURL

        public java.net.URL getURL()
        Returns the URL on which this URLDataSource is based.
        Overrides:
        getURL in class DataSource
        Returns:
        the URL