|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object freemarker.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 a BinaryDataFactory
object, in which case it is read in immediately.
To retrieve 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
,
BinaryDataFactory
,
Serialized FormField 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(java.io.InputStream stream)
Clones an existing BinaryData instance. |
|
BinaryData(java.io.InputStream stream,
Cache cache)
Clones an existing BinaryData instance. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clones the current BinaryData object. |
void |
compile(java.io.InputStream stream)
Compiles the template from an InputStream . |
Cache |
getCache()
Retrieve the Cache that this object is stored in. |
int |
getContentLength()
Returns the length of the binary data, in bytes. |
void |
process(java.io.OutputStream out)
Processes the binary data file, and output the resulting binary data to an OutputStream. |
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(java.io.InputStream stream) throws java.io.IOException
BinaryData
instance.
stream
- an InputStream
from which the
template can be read.
java.io.IOException
public BinaryData(java.io.InputStream stream, Cache cache) throws java.io.IOException
BinaryData
instance.
stream
- an InputStream
from which the
template can be read.
java.io.IOException
Method Detail |
---|
public void compile(java.io.InputStream stream) throws java.io.IOException, java.lang.IllegalArgumentException
InputStream
. If the template
has already been compiled, this method does nothing.
stream
- an InputStream
from which the
template can be read.
java.io.IOException
java.lang.IllegalArgumentException
public void process(java.io.OutputStream out)
out
- an OutputStream to output the binary data to.public int getContentLength()
public Cache getCache()
Cache
that this object is stored in.
getCache
in interface Cacheable
Cache
that this template belongs to.public java.lang.Object clone()
BinaryData
object.
clone
in class java.lang.Object
BinaryData
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 |