freemarker.template
Class BinaryDataFactory

java.lang.Object
  extended by freemarker.template.BinaryDataFactory
All Implemented Interfaces:
CompileableFactory<BinaryData>

public final class BinaryDataFactory
extends java.lang.Object
implements CompileableFactory<BinaryData>

A factory class that can create BinaryData objects for various inputs.

Since:
1.9
Version:
$Id: BinaryDataFactory.java 1112 2013-04-12 02:59:25Z run2000 $
Author:
Nicholas Cull

Field Summary
static BinaryDataFactory INSTANCE
          The singleton instance of this BinaryDataFactory.
 
Method Summary
 BinaryData create(CompileableFactoryParameters params)
          Create an instance of a BinaryData object from the given InputStream.
 BinaryData createFromFile(java.io.File file)
          Create an instance of a BinaryData object from the given file.
 BinaryData createFromFile(java.lang.String filePath)
          Create an instance of a BinaryData object from the given file path.
 BinaryData createFromStream(java.io.InputStream stream)
          Create an instance of a BinaryData object from the given InputStream.
 BinaryData createFromStream(java.io.InputStream stream, java.lang.String encoding)
          Create an instance of a BinaryData object from the given InputStream.
 java.lang.String getName()
          Return a name for the compilable object created by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final BinaryDataFactory INSTANCE
The singleton instance of this BinaryDataFactory.

Method Detail

getName

public java.lang.String getName()
Return a name for the compilable object created by this factory.

Specified by:
getName in interface CompileableFactory<BinaryData>
Returns:
"binary", to indicate this factory creates a binary compilable object

create

public BinaryData create(CompileableFactoryParameters params)
                  throws java.io.IOException
Create an instance of a BinaryData object from the given InputStream.

Specified by:
create in interface CompileableFactory<BinaryData>
Parameters:
params -
Returns:
a newly created BinaryData object from the given input stream
Throws:
java.io.IOException - there was a problem reading from the input stream

createFromStream

public BinaryData createFromStream(java.io.InputStream stream)
                            throws java.io.IOException
Create an instance of a BinaryData object from the given InputStream.

Parameters:
stream - the input stream from which the BinaryData object will be created
Returns:
a newly created BinaryData object from the given input stream
Throws:
java.io.IOException - there was a problem reading from the input stream

createFromStream

public BinaryData createFromStream(java.io.InputStream stream,
                                   java.lang.String encoding)
                            throws java.io.IOException
Create an instance of a BinaryData object from the given InputStream.

Parameters:
stream - the input stream from which the BinaryData object will be created
encoding - ignored
Returns:
a newly created BinaryData object from the given input stream
Throws:
java.io.IOException - there was a problem reading from the input stream

createFromFile

public BinaryData createFromFile(java.io.File file)
                          throws java.io.IOException
Create an instance of a BinaryData object from the given file.

Parameters:
file - the file from which the BinaryData object will be created
Returns:
a newly created BinaryData object from the given input stream
Throws:
java.io.IOException - there was a problem reading from the input stream

createFromFile

public BinaryData createFromFile(java.lang.String filePath)
                          throws java.io.IOException
Create an instance of a BinaryData object from the given file path.

Parameters:
filePath - the file path from which the BinaryData object will be created
Returns:
a newly created BinaryData object from the given input stream
Throws:
java.io.IOException - there was a problem reading from the input stream