|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.webmacro.util.Encoder
An encoder is used to encode strings into a particular encoding in preparation for sending the data as part of a response. An encoder is constructed with a particular output encoding and is then expected to properly encode strings with that output encoding for its lifetime.
Encoder
instances are obtained via the
EncoderProvider
implementation that is configured at
initialization time. The encoder provider is responsible communicating
the encoding scheme to be used by the encoder at construct time.
The mechanism is factored into the encoder interface to allow for caching encoders with differing caching schemes based on the server environment's requirements or no caching scheme at all.
EncoderProvider
,
SimpleEncoder
Nested Class Summary | |
static class |
Encoder.Block
The block class provides a means by which encoder users can encode entire blocks of text at once (and have those encoded blocks cached). |
Constructor Summary | |
Encoder(java.lang.String encoding)
Creates an encoder instance with the supplied encoding. |
Method Summary | |
byte[][] |
encode(Encoder.Block source)
Encodes the supplied block of strings using the encoding bound to this encoder at construct time. |
byte[] |
encode(java.lang.String source)
Encodes the supplied string using the encoding bound to this encoder at construct time. |
void |
init(Broker b,
Settings config)
Initialize this provider based on the specified config. |
java.lang.Object |
load(java.lang.Object query,
CacheElement ce)
Load an object from permanent storage (or construct it) on demand. |
java.lang.Object |
load(java.lang.String query,
CacheElement ce)
Load an object from permanent storage (or construct it) on demand. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Encoder(java.lang.String encoding) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
- Thrown when the underlying
Java encoding mechanism does not provide support for the requesting
encoding.Method Detail |
public void init(Broker b, Settings config) throws InitException
ResourceLoader
init
in interface ResourceLoader
InitException
public java.lang.Object load(java.lang.Object query, CacheElement ce) throws ResourceException
load
in interface ResourceLoader
ResourceException
public java.lang.Object load(java.lang.String query, CacheElement ce) throws ResourceException
ResourceLoader
load
in interface ResourceLoader
ResourceException
public final byte[] encode(java.lang.String source) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
- Thrown when the underlying
Java encoding mechanism does not provide support for the encoding
used by this encoder instance.public final byte[][] encode(Encoder.Block source) throws java.io.UnsupportedEncodingException
java.io.UnsupportedEncodingException
- Thrown when the underlying
Java encoding mechanism does not provide support for the encoding
used by this encoder instance.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |