Apache log4cxx  Version 0.12.1
log4cxx::helpers::CharsetEncoder Class Referenceabstract

An engine to transform LogStrings into bytes for the specific character set. More...

#include <charsetencoder.h>

Inheritance diagram for log4cxx::helpers::CharsetEncoder:
log4cxx::helpers::Object

Public Member Functions

virtual ~CharsetEncoder ()
 Destructor. More...
 
virtual log4cxx_status_t encode (const LogString &in, LogString::const_iterator &iter, ByteBuffer &out)=0
 Encodes as many characters from the input string as possible to the output buffer. More...
 
virtual void reset ()
 Resets any internal state. More...
 
virtual void flush (ByteBuffer &out)
 Flushes the encoder. More...
 
- Public Member Functions inherited from log4cxx::helpers::Object
virtual ~Object ()
 
virtual bool instanceof (const Class &clazz) const =0
 
virtual const void * cast (const Class &clazz) const =0
 

Static Public Member Functions

static CharsetEncoderPtr getDefaultEncoder ()
 Get encoder for default charset. More...
 
static CharsetEncoderPtr getEncoder (const LogString &charset)
 Get encoder for specified character set. More...
 
static CharsetEncoderPtr getUTF8Encoder ()
 Get encoder for UTF-8. More...
 
static void encode (CharsetEncoderPtr &enc, const LogString &src, LogString::const_iterator &iter, ByteBuffer &dst)
 Encodes a string replacing unmappable characters with escape sequences. More...
 
static bool isError (log4cxx_status_t stat)
 Determines if the return value from encode indicates an unconvertable character. More...
 

Protected Member Functions

 CharsetEncoder ()
 Protected constructor. More...
 

Detailed Description

An engine to transform LogStrings into bytes for the specific character set.

Constructor & Destructor Documentation

◆ CharsetEncoder()

log4cxx::helpers::CharsetEncoder::CharsetEncoder ( )
protected

Protected constructor.

◆ ~CharsetEncoder()

virtual log4cxx::helpers::CharsetEncoder::~CharsetEncoder ( )
virtual

Destructor.

Member Function Documentation

◆ encode() [1/2]

static void log4cxx::helpers::CharsetEncoder::encode ( CharsetEncoderPtr &  enc,
const LogString src,
LogString::const_iterator &  iter,
ByteBuffer dst 
)
static

Encodes a string replacing unmappable characters with escape sequences.

◆ encode() [2/2]

virtual log4cxx_status_t log4cxx::helpers::CharsetEncoder::encode ( const LogString in,
LogString::const_iterator &  iter,
ByteBuffer out 
)
pure virtual

Encodes as many characters from the input string as possible to the output buffer.

Parameters
ininput string
iterposition in string to start.
outoutput buffer.
Returns
APR_SUCCESS unless a character can not be represented in the encoding.

◆ flush()

virtual void log4cxx::helpers::CharsetEncoder::flush ( ByteBuffer out)
virtual

Flushes the encoder.

◆ getDefaultEncoder()

static CharsetEncoderPtr log4cxx::helpers::CharsetEncoder::getDefaultEncoder ( )
static

Get encoder for default charset.

◆ getEncoder()

static CharsetEncoderPtr log4cxx::helpers::CharsetEncoder::getEncoder ( const LogString charset)
static

Get encoder for specified character set.

Parameters
charsetthe following values should be recognized: "US-ASCII", "ISO-8859-1", "UTF-8", "UTF-16BE", "UTF-16LE".
Returns
encoder.
Exceptions
IllegalArgumentExceptionif encoding is not recognized.

◆ getUTF8Encoder()

static CharsetEncoderPtr log4cxx::helpers::CharsetEncoder::getUTF8Encoder ( )
static

Get encoder for UTF-8.

◆ isError()

static bool log4cxx::helpers::CharsetEncoder::isError ( log4cxx_status_t  stat)
inlinestatic

Determines if the return value from encode indicates an unconvertable character.

◆ reset()

virtual void log4cxx::helpers::CharsetEncoder::reset ( )
virtual

Resets any internal state.


The documentation for this class was generated from the following file: