org.jboss.portal.common.text
Class EntityEncoder

java.lang.Object
  extended by org.jboss.portal.common.text.AbstractCharEncoder
      extended by org.jboss.portal.common.text.EntityEncoder
All Implemented Interfaces:
CharEncoder

public class EntityEncoder
extends AbstractCharEncoder

This encoder performs lookup for converting a char to its HTML entity representation.

Version:
$Revision: 630 $
Author:
Julien Viet

Field Summary
static EntityEncoder BASIC
          All HTML entities except the HTML chars which are used to do HTML itself.
static EntityEncoder FULL
          All HTML entities.
 
Constructor Summary
protected EntityEncoder()
           
 
Method Summary
 java.lang.String lookup(char c)
          Returns null if no entity is found or return the converted entity.
protected  void put(int c, java.lang.String entity)
           
protected  void remove(int c)
           
 void safeEncode(char[] chars, int off, int len, CharWriter writer)
           
 void safeEncode(char c, CharWriter writer)
           
 
Methods inherited from class org.jboss.portal.common.text.AbstractCharEncoder
encode, encode, encode, encode, encode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FULL

public static final EntityEncoder FULL
All HTML entities.


BASIC

public static final EntityEncoder BASIC
All HTML entities except the HTML chars which are used to do HTML itself.

Constructor Detail

EntityEncoder

protected EntityEncoder()
Method Detail

safeEncode

public void safeEncode(char c,
                       CharWriter writer)
                throws EncodingException
Throws:
EncodingException

safeEncode

public void safeEncode(char[] chars,
                       int off,
                       int len,
                       CharWriter writer)
                throws EncodingException
Specified by:
safeEncode in class AbstractCharEncoder
Throws:
EncodingException

put

protected final void put(int c,
                         java.lang.String entity)

remove

protected final void remove(int c)

lookup

public final java.lang.String lookup(char c)
Returns null if no entity is found or return the converted entity.

Parameters:
c - the char to encode
Returns:
the corresponding encoded string or null