|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectfreemarker.template.BinaryData
public class BinaryData
An application or servlet can instantiate a 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(java.io.OutputStream) 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
Cache do this for you.
FileTemplateCache,
Serialized Form| Field Summary | |
|---|---|
protected Cache |
cache
The cache to which this binary data object belongs (if any). |
protected byte[] |
dataArray
The binary data held by this object. |
| Constructor Summary | |
|---|---|
BinaryData()
Constructs an empty binary object. |
|
BinaryData(BinaryData data)
Clones an existing BinaryData instance. |
|
BinaryData(java.io.File file)
Deprecated. Use the InputSource constructor instead |
|
BinaryData(InputSource source)
Clones an existing BinaryData instance. |
|
BinaryData(java.io.InputStream stream)
Deprecated. Use the InputSource constructor instead |
|
BinaryData(java.lang.String filePath)
Deprecated. Use the InputSource constructor instead |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Clones the current BinaryData object. |
void |
compile(InputSource source)
Compiles the template from an InputSource. |
void |
compileFromFile(java.io.File file)
Deprecated. Use the compile(freemarker.template.InputSource) method instead |
void |
compileFromFile(java.lang.String filePath)
Deprecated. Use the compile(freemarker.template.InputSource) method instead |
void |
compileFromStream(java.io.InputStream stream)
Deprecated. Use the compile(freemarker.template.InputSource) method instead |
void |
compileFromStream(java.io.InputStream stream,
java.lang.String encoding)
Deprecated. Use the compile(freemarker.template.InputSource) method instead |
Cache |
getCache()
Retrieve the Cache that this object is
stored in. |
void |
process(java.io.OutputStream out)
Processes the binary data file, and output the resulting binary data to an OutputStream. |
void |
setCache(Cache cache)
Sets the Cache that this object is
stored in. |
java.lang.String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected byte[] dataArray
protected transient Cache cache
| Constructor Detail |
|---|
public BinaryData()
public BinaryData(java.lang.String filePath)
throws java.io.IOException
InputSource constructor instead
compileFromFile().
filePath - the absolute path of the binary file to be compiled.
java.io.IOException
public BinaryData(java.io.File file)
throws java.io.IOException
InputSource constructor instead
compileFromFile().
file - a File representing the binary file to be
compiled.
java.io.IOException
public BinaryData(java.io.InputStream stream)
throws java.io.IOException
InputSource constructor instead
InputStream.
Calls compileFromStream().
stream - an InputStream from which the template can be
read.
java.io.IOException
public BinaryData(InputSource source)
throws java.io.IOException
BinaryData instance.
source - an InputSource from which the template can be
read.
java.io.IOExceptionpublic BinaryData(BinaryData data)
BinaryData instance.
data - the BinaryData instance to be cloned| Method Detail |
|---|
public void compileFromFile(java.lang.String filePath)
throws java.io.IOException
compile(freemarker.template.InputSource) method instead
filePath - the absolute path of the template file to be compiled.
java.io.IOException
public void compileFromFile(java.io.File file)
throws java.io.IOException
compile(freemarker.template.InputSource) method instead
file - a File representing the template file to be compiled.
java.io.IOException
public void compileFromStream(java.io.InputStream stream)
throws java.io.IOException
compile(freemarker.template.InputSource) method instead
compileFromStream in interface Compileablestream - an InputStream from which the template can be read.
java.io.IOException
public void compileFromStream(java.io.InputStream stream,
java.lang.String encoding)
throws java.io.IOException
compile(freemarker.template.InputSource) method instead
compileFromStream in interface Compileablestream - an InputStream from which the template can be read.encoding - the character encoding to use. For binary data, this does
nothing.
java.io.IOException
public void compile(InputSource source)
throws java.io.IOException,
java.lang.IllegalArgumentException
InputSource. If the template
has already been compiled, this method does nothing.
compile in interface Compileablesource - an InputSource from which the template can be
read.
java.io.IOException
java.lang.IllegalArgumentExceptionpublic void process(java.io.OutputStream out)
out - an OutputStream to output the HTML to.public void setCache(Cache cache)
Cache that this object is
stored in. IncludeInstruction objects will be able to request
this Cache at run-time.
setCache in interface Cacheablecache - the Cache that this template belongs to.public Cache getCache()
Cache that this object is
stored in.
getCache in interface CacheableCache that this template belongs to.public java.lang.Object clone()
BinaryData object.
clone in interface Cacheableclone in class java.lang.ObjectBinaryData objectpublic java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||