org.apache.cocoon.components.source
Class FileSource
java.lang.Object
|
+--org.apache.avalon.framework.logger.AbstractLoggable
|
+--org.apache.cocoon.components.source.AbstractStreamSource
|
+--org.apache.cocoon.components.source.AbstractStreamWriteableSource
|
+--org.apache.cocoon.components.source.FileSource
- All Implemented Interfaces:
- org.apache.avalon.framework.logger.Loggable, ModifiableSource, org.apache.avalon.excalibur.pool.Poolable, org.apache.avalon.excalibur.pool.Recyclable, Source, WriteableSource, XMLizable
- public class FileSource
- extends AbstractStreamWriteableSource
- implements WriteableSource
A WriteableSource for 'file:/' system IDs.
- Version:
- $Id: FileSource.java,v 1.2.2.2 2002/09/21 02:23:52 vgritsenko Exp $
- Author:
- Sylvain Wallez
|
Constructor Summary |
FileSource(java.lang.String url,
org.apache.avalon.framework.component.ComponentManager manager)
Create a file source from a 'file:' url and a component manager. |
|
Method Summary |
boolean |
canCancel(java.io.OutputStream stream)
Always return false. |
void |
cancel(java.io.OutputStream stream)
Cancels the output stream. |
boolean |
exists()
Does this source actually exist ? |
long |
getContentLength()
Get the content length of the source or -1 if it
is not possible to determine the length. |
java.io.InputStream |
getInputStream()
Get the input stream for this source. |
long |
getLastModified()
Get the last modification date of the source or 0 if it
is not possible to determine the date. |
java.io.OutputStream |
getOutputStream()
Get an output stream to write to this source. |
java.lang.String |
getSystemId()
Return the unique identifer for this source |
protected boolean |
isHTMLContent()
Returns true if the file name ends with ".htm" or ".html". |
| Methods inherited from class org.apache.avalon.framework.logger.AbstractLoggable |
getLogger, setLogger, setupLogger, setupLogger, setupLogger |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.apache.avalon.excalibur.pool.Recyclable |
recycle |
| Methods inherited from interface org.apache.cocoon.xml.XMLizable |
toSAX |
FileSource
public FileSource(java.lang.String url,
org.apache.avalon.framework.component.ComponentManager manager)
- Create a file source from a 'file:' url and a component manager.
exists
public boolean exists()
- Description copied from interface:
WriteableSource
- Does this source actually exist ?
- Specified by:
exists in interface WriteableSource- Overrides:
exists in class AbstractStreamSource
- Following copied from interface:
org.apache.cocoon.environment.WriteableSource
- Returns:
- true if the resource exists.
isHTMLContent
protected boolean isHTMLContent()
- Returns
true if the file name ends with ".htm" or ".html".
- Overrides:
isHTMLContent in class AbstractStreamSource
getSystemId
public java.lang.String getSystemId()
- Return the unique identifer for this source
- Specified by:
getSystemId in interface Source
getInputStream
public java.io.InputStream getInputStream()
throws java.io.IOException,
ProcessingException
- Get the input stream for this source.
- Specified by:
getInputStream in interface Source
getLastModified
public long getLastModified()
- Description copied from interface:
Source
- 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- Overrides:
getLastModified in class AbstractStreamSource
getContentLength
public long getContentLength()
- Description copied from interface:
Source
- Get the content length of the source or -1 if it
is not possible to determine the length.
- Specified by:
getContentLength in interface Source- Overrides:
getContentLength in class AbstractStreamSource
getOutputStream
public java.io.OutputStream getOutputStream()
throws java.io.IOException,
ProcessingException
- Get an output stream to write to this source. The output stream returned
actually writes to a temp file that replaces the real one on close. This
temp file is used as lock to forbid multiple simultaneous writes. The
real file is updated atomically when the output stream is closed.
- Specified by:
getOutputStream in interface WriteableSource
- Throws:
java.util.ConcurrentModificationException - if another thread is currently
writing to this file.
canCancel
public boolean canCancel(java.io.OutputStream stream)
- Always return
false. To be redefined by implementations that support
cancel().
- Specified by:
canCancel in interface WriteableSource- Overrides:
canCancel in class AbstractStreamWriteableSource
- Following copied from interface:
org.apache.cocoon.environment.WriteableSource
- Returns:
- true if the stream can be cancelled
cancel
public void cancel(java.io.OutputStream stream)
throws java.lang.Exception
- Cancels the output stream.
- Specified by:
cancel in interface WriteableSource- Overrides:
cancel in class AbstractStreamWriteableSource
Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.