|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--freemarker.template.BinaryData
An application or servlet can instantiate a subclass of BinaryData to retrieve a binary file.
You can pass the filename of the binary file to the constructor, in which case it is read in immediately.
To retrive the binary data, call the process() method.
To facilitate multithreading, BinaryData objects are immutable; if you need to reload a binary file, you must make a new BinaryData object. In most cases, it will be sufficient to let a BinaryCache do this for you.
BinaryCache| Constructor Summary | |
BinaryData()
Constructs an empty template. |
|
BinaryData(java.io.File file)
Constructs a BinaryData object by compiling it from a file. |
|
BinaryData(java.io.InputStream stream)
Constructs a template by compiling it from an InputStream. |
|
BinaryData(java.lang.String filePath)
Constructs a binary data object by compiling it from a file. |
|
| Method Summary | |
void |
compileFromFile(java.io.File file)
Reads and compiles a template from a file, by getting the file's FileInputStream and using it to call compileFromStream(), using the platform's default character encoding. |
void |
compileFromFile(java.lang.String filePath)
Reads and compiles a template from a file, by getting the file's FileInputStream and using it to call compileFromStream(), using the platform's default character encoding. |
void |
compileFromStream(java.io.InputStream stream)
Compiles the template from an InputStream, using the platform's default character encoding. |
static java.lang.String |
formatErrorMessage(java.lang.String errorMessage)
Used by FreeMarker classes to format an error message as an HTML comment. |
BinaryCache |
getBinaryCache()
Gets the BinaryCache that this binary data file belongs to. |
static java.lang.String |
getStackTrace(java.lang.Exception e)
Used by FreeMarker classes to format a stack trace as a string. |
void |
process(java.io.OutputStream out)
Processes the binary data file, and output the resulting binary data to an OutputStream. |
void |
setBinaryCache(BinaryCache cache)
Sets the BinaryCache that this file belongs to. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public BinaryData()
public BinaryData(java.lang.String filePath)
throws java.io.IOException
filePath - the absolute path of the binary file
to be compiled.
public BinaryData(java.io.File file)
throws java.io.IOException
file - a File representing the
binary file to be compiled.
public BinaryData(java.io.InputStream stream)
throws java.io.IOException
stream - an InputStream from which the
template can be read.| Method Detail |
public void compileFromFile(java.lang.String filePath)
throws java.io.IOException
filePath - the absolute path of the template file
to be compiled.
public void compileFromFile(java.io.File file)
throws java.io.IOException
file - a File representing the
template file to be compiled.
public void compileFromStream(java.io.InputStream stream)
throws java.io.IOException
stream - an InputStream from which the
template can be read.public void setBinaryCache(BinaryCache cache)
cache - the BinaryCache that this binary data file belongs to.public BinaryCache getBinaryCache()
public void process(java.io.OutputStream out)
modelRoot - the root node of the data model. If null, an
empty data model is used.out - an OutputStream to output the HTML to.public static java.lang.String formatErrorMessage(java.lang.String errorMessage)
public static java.lang.String getStackTrace(java.lang.Exception e)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||