org.apache.excalibur.source.impl
Class ResourceSource

java.lang.Object
  extended by org.apache.excalibur.source.impl.AbstractSource
      extended by org.apache.excalibur.source.impl.ResourceSource
All Implemented Interfaces:
Source

public final class ResourceSource
extends AbstractSource
implements Source

Description of a source which is described by the resource protocol which gets a resource from the classloader.

Version:
CVS $Revision: 1.4 $ $Date: 2004/02/28 11:47:24 $
Author:
Avalon Development Team

Constructor Summary
ResourceSource(String systemId)
           
 
Method Summary
 boolean exists()
          Does this source exist ?
protected  ClassLoader getClassLoader()
           
protected  void getInfos()
          Get the last modification date and content length of the source.
 InputStream getInputStream()
          Return an InputStream object to read from the source.
 String getMimeType()
          The mime-type of the content described by this object.
 SourceValidity getValidity()
          Returns TimeStampValidity as resources may change in a directory-based classloader.
 
Methods inherited from class org.apache.excalibur.source.impl.AbstractSource
checkInfos, getContentLength, getLastModified, getScheme, getURI, refresh, setContentLength, setLastModified, setScheme, setSystemId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.excalibur.source.Source
getContentLength, getLastModified, getScheme, getURI, refresh
 

Constructor Detail

ResourceSource

public ResourceSource(String systemId)
               throws MalformedURLException
Throws:
MalformedURLException
Method Detail

exists

public boolean exists()
Description copied from interface: Source
Does this source exist ?

Specified by:
exists in interface Source
Returns:
true if the source exists

getInfos

protected void getInfos()
Description copied from class: AbstractSource
Get the last modification date and content length of the source. Any exceptions are ignored. Override this to get the real information

Overrides:
getInfos in class AbstractSource

getMimeType

public String getMimeType()
Description copied from class: AbstractSource
The mime-type of the content described by this object. If the source is not able to determine the mime-type by itself this can be null.

Specified by:
getMimeType in interface Source
Overrides:
getMimeType in class AbstractSource
Returns:
the source's mime-type or null.

getInputStream

public InputStream getInputStream()
                           throws IOException,
                                  SourceException
Return an InputStream object to read from the source. The returned stream must be closed by the calling code.

Specified by:
getInputStream in interface Source
Overrides:
getInputStream in class AbstractSource
Returns:
the InputStream to read data from (never null).
Throws:
SourceException - if file not found or HTTP location does not exist.
IOException - if I/O error occured.

getValidity

public SourceValidity getValidity()
Returns TimeStampValidity as resources may change in a directory-based classloader.

Specified by:
getValidity in interface Source
Overrides:
getValidity in class AbstractSource
Returns:
the validity, or null.

getClassLoader

protected ClassLoader getClassLoader()


Copyright © 1997-2012 The Apache Software Foundation. All Rights Reserved.