freemarker.template
Class InputSource

java.lang.Object
  extended by freemarker.template.InputSource
Direct Known Subclasses:
FileInputSource, StringInputSource

public class InputSource
extends java.lang.Object

Provides an input stream or character stream to be compiled into a FM-Classic template. Similar in concept to the SAX library's InputSource class.

Since:
1.9
Version:
$Id: InputSource.java 1153 2005-10-09 08:48:56Z run2000 $

Field Summary
protected  java.lang.String encoding
          A specific character encoding for the input stream.
protected  java.io.Reader reader
          A reader from which a template can be compiled.
protected  java.io.InputStream stream
          An input stream from which a template can be compiled.
 
Constructor Summary
InputSource()
          Create an empty InputSource.
InputSource(java.io.InputStream stream)
          Create an InputSource with the supplied input stream.
InputSource(java.io.InputStream stream, java.lang.String encoding)
          Create an InputSource with the supplied input stream and character encoding.
InputSource(java.io.Reader reader)
          Create an InputSource with the supplied reader.
 
Method Summary
 java.lang.String getEncoding()
          Get the character encoding for the input stream provided by this InputSource.
 java.io.InputStream getInputStream()
          Get the input stream provided by this InputSource.
 java.io.Reader getReader()
          Get the reader provided by this InputSource.
 void setEncoding(java.lang.String encoding)
          Set the character encoding for the input stream provided by this InputSource.
 void setInputStream(java.io.InputStream stream)
          Set the input stream to be provided by this InputSource.
 void setReader(java.io.Reader reader)
          Set the reader to be provided by this InputSource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

stream

protected java.io.InputStream stream
An input stream from which a template can be compiled.


encoding

protected java.lang.String encoding
A specific character encoding for the input stream.


reader

protected java.io.Reader reader
A reader from which a template can be compiled.

Constructor Detail

InputSource

public InputSource()
Create an empty InputSource.


InputSource

public InputSource(java.io.InputStream stream)
Create an InputSource with the supplied input stream.

Parameters:
stream - the input stream to be provided by this InputSource

InputSource

public InputSource(java.io.InputStream stream,
                   java.lang.String encoding)
Create an InputSource with the supplied input stream and character encoding.

Parameters:
stream - the input stream to be provided by this InputSource
encoding - the character encoding for this input stream

InputSource

public InputSource(java.io.Reader reader)
Create an InputSource with the supplied reader.

Parameters:
reader - the reader to be provided by this InputSource
Method Detail

getInputStream

public java.io.InputStream getInputStream()
Get the input stream provided by this InputSource.

Returns:
the input stream for this InputSource

setInputStream

public void setInputStream(java.io.InputStream stream)
Set the input stream to be provided by this InputSource.

Parameters:
stream - the input stream for this InputSource

getEncoding

public java.lang.String getEncoding()
Get the character encoding for the input stream provided by this InputSource.

Returns:
the character encoding for the input stream

setEncoding

public void setEncoding(java.lang.String encoding)
Set the character encoding for the input stream provided by this InputSource.

Parameters:
encoding - the character encoding for the input source

getReader

public java.io.Reader getReader()
Get the reader provided by this InputSource.

Returns:
the reader for this InputSource

setReader

public void setReader(java.io.Reader reader)
Set the reader to be provided by this InputSource.

Parameters:
reader - the reader for this InputSource