EchoPoint
1.0

echopoint.template
Class StreamDataSource

java.lang.Object
  extended byechopoint.template.AbstractDataSource
      extended byechopoint.template.StreamDataSource
All Implemented Interfaces:
DataSource, java.io.Serializable

public class StreamDataSource
extends AbstractDataSource

A StreamDataSource implements a DataSource as a wrapper around a Stream or Reader

See Also:
Serialized Form

Field Summary
 
Fields inherited from class echopoint.template.AbstractDataSource
DEFAULT_ENCODING
 
Constructor Summary
StreamDataSource(java.io.InputStream iStream)
          generates a new StreamDataSource with the given Stream
StreamDataSource(java.io.InputStream iStream, java.lang.String encoding)
          generates a new StreamDataSource with the given Stream
 
Method Summary
 java.lang.String getCanonicalName()
          returns the canonical name of the inputStream (uaaaah!)
 java.io.Reader getInputReader()
          Gets an Reader of the File.
 long lastModified()
          Returns the time the content of this stream was last modified.
 void setInputStream(java.io.InputStream iStream)
          sets the InputStream and the modificationTime
 void setModificationTime()
          sets the modificationTime to the currentTimeMillis
 void setReader(java.io.Reader iReader)
          sets the Reader and the modificationTime to the currentTimeMillis
 
Methods inherited from class echopoint.template.AbstractDataSource
getCharacterEncoding, setCharacterEncoding
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamDataSource

public StreamDataSource(java.io.InputStream iStream)
                 throws java.io.UnsupportedEncodingException

generates a new StreamDataSource with the given Stream

Parameters:
iStream - the InputStream from which the template is read.

StreamDataSource

public StreamDataSource(java.io.InputStream iStream,
                        java.lang.String encoding)
                 throws java.io.UnsupportedEncodingException

generates a new StreamDataSource with the given Stream

Parameters:
iStream - the InputStream from which the template is read.
Method Detail

getCanonicalName

public java.lang.String getCanonicalName()

returns the canonical name of the inputStream (uaaaah!)

Specified by:
getCanonicalName in interface DataSource
Specified by:
getCanonicalName in class AbstractDataSource
Returns:

always null, because stream is always to be parsed


getInputReader

public java.io.Reader getInputReader()
                              throws java.io.IOException
Gets an Reader of the File.

Specified by:
getInputReader in interface DataSource
Specified by:
getInputReader in class AbstractDataSource
Returns:
the actually set InputStream
Throws:
java.io.IOException

lastModified

public long lastModified()

Returns the time the content of this stream was last modified.

The return value is used to decide whether to reparse a Source or not. Reparsing is done if the value returned here differs from the value returned at the last processing time.

Attention: Modificationtime is only updated if a new stream is set!

Specified by:
lastModified in interface DataSource
Specified by:
lastModified in class AbstractDataSource
Returns:
long a modification time

setInputStream

public void setInputStream(java.io.InputStream iStream)
                    throws java.io.UnsupportedEncodingException

sets the InputStream and the modificationTime

Parameters:
iStream - the InputStream from which the template is read.
Throws:
java.io.UnsupportedEncodingException

setModificationTime

public void setModificationTime()

sets the modificationTime to the currentTimeMillis


setReader

public void setReader(java.io.Reader iReader)

sets the Reader and the modificationTime to the currentTimeMillis

Parameters:
iReader - the Reader from which the template is read.

EchoPoint
1.0