org.jboss.portal.common.text
Interface CharToByteEncoder

All Known Implementing Classes:
CharToByteEncoder.Generic

public interface CharToByteEncoder

Defines an interface for encoding a char to a sequence of bytes.

Version:
$Revision: 1.1 $
Author:
Julien Viet

Nested Class Summary
static class CharToByteEncoder.Generic
          Generic implementation that works for any charset, based on NIO.
 
Field Summary
static byte[] EMPTY
          .
 
Method Summary
 byte[] encode(char c)
          Encode the specified char.
 

Field Detail

EMPTY

static final byte[] EMPTY
.

Method Detail

encode

byte[] encode(char c)
              throws EncodingException
Encode the specified char. The returned byte array can be used safely until a new invocation to the same object is done. If the returned array has a length of zero it means that the char cannot be encoded.

Parameters:
c - the char to encode
Returns:
the encoded char as a byte array
Throws:
EncodingException