org.apache.cocoon.components.source
Class URLSource

java.lang.Object
  |
  +--org.apache.cocoon.components.source.URLSource
All Implemented Interfaces:
ModifiableSource, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, Source, XMLizable

public final class URLSource
extends java.lang.Object
implements ModifiableSource

Description of a source which is described by an URL.

Version:
CVS $Revision: 1.1.2.17 $ $Date: 2001/10/26 08:41:41 $
Author:
Carsten Ziegeler

Field Summary
static char[] alphabet
           
 
Constructor Summary
URLSource(java.net.URL url, org.apache.avalon.framework.component.ComponentManager manager)
          Construct a new object
 
Method Summary
static java.lang.String encodeBASE64(byte[] octetString)
          BASE 64 encoding.
static java.lang.String encodeBASE64(java.lang.String s)
          BASE 64 encoding.
 long getContentLength()
          Get the content length of the source or -1 if it is not possible to determine the length.
 org.xml.sax.InputSource getInputSource()
          Return a new InputSource object
 java.io.InputStream getInputStream()
          Return an InputStream object to read from the source.
 long getLastModified()
          Get the last modification date of the source or 0 if it is not possible to determine the date.
 java.lang.String getSystemId()
          Return the unique identifer for this source
 void recycle()
           
 void refresh()
          Refresh this object and update the last modified date and content length.
 void toSAX(org.xml.sax.ContentHandler handler)
          Stream content to a content handler or to an XMLConsumer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

alphabet

public static final char[] alphabet
Constructor Detail

URLSource

public URLSource(java.net.URL url,
                 org.apache.avalon.framework.component.ComponentManager manager)
          throws java.io.IOException
Construct a new object
Method Detail

getLastModified

public long getLastModified()
Get the last modification date of the source or 0 if it is not possible to determine the date.
Specified by:
getLastModified in interface Source

getContentLength

public long getContentLength()
Get the content length of the source or -1 if it is not possible to determine the length.
Specified by:
getContentLength in interface Source

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException,
                                          ProcessingException
Return an InputStream object to read from the source.
Specified by:
getInputStream in interface Source
Throws:
ResourceNotFoundException - if file not found or HTTP location does not exist.
java.io.IOException - if I/O error occured.

getSystemId

public java.lang.String getSystemId()
Return the unique identifer for this source
Specified by:
getSystemId in interface Source

refresh

public void refresh()
Refresh this object and update the last modified date and content length.
Specified by:
refresh in interface ModifiableSource

getInputSource

public org.xml.sax.InputSource getInputSource()
                                       throws java.io.IOException,
                                              ProcessingException
Return a new InputSource object
Specified by:
getInputSource in interface Source
Throws:
ResourceNotFoundException - if file not found or HTTP location does not exist.
java.io.IOException - if I/O error occured.

encodeBASE64

public static java.lang.String encodeBASE64(java.lang.String s)
BASE 64 encoding. See also RFC 1421
Since:
1.2

encodeBASE64

public static java.lang.String encodeBASE64(byte[] octetString)
BASE 64 encoding. See also RFC 1421
Since:
1.2

toSAX

public void toSAX(org.xml.sax.ContentHandler handler)
           throws org.xml.sax.SAXException,
                  ProcessingException
Stream content to a content handler or to an XMLConsumer.
Specified by:
toSAX in interface XMLizable
Throws:
ResourceNotFoundException - if file not found or HTTP location does not exist.
org.xml.sax.SAXException - if failed to parse source document.

recycle

public void recycle()
Specified by:
recycle in interface org.apache.avalon.excalibur.pool.Recyclable


Copyright © 1999-2001 Apache Software Foundation. All Rights Reserved.