CharsetEncoder Class Referenceabstract

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

Inheritance diagram for CharsetEncoder:

## 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 ObjectImpl
| ObjectImpl ()
virtual | ~ObjectImpl ()
void | addRef () const
void | releaseRef () const
Public Member Functions inherited from Object
virtual const helpers::Class & | getClass () const
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...
Static Public Member Functions inherited from Object
static const helpers::Class & | getStaticClass ()
static const log4cxx::helpers::ClassRegistration & | registerClass ()

## Protected Member Functions

| CharsetEncoder ()
| Protected constructor. More...

## Additional Inherited Members

Protected Attributes inherited from ObjectImpl
unsigned int volatile | ref

## Detailed Description

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

## Constructor & Destructor Documentation

CharsetEncoder | ( |  | ) |

protected

Protected constructor.

virtual ~CharsetEncoder | ( |  | ) |

virtual

Destructor.

## Member Function Documentation

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

static

Encodes a string replacing unmappable characters with escape sequences.

virtual log4cxx_status_t 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

  in | input string
  iter | position in string to start.
  out | output buffer.

Returns
  APR_SUCCESS unless a character can not be represented in the encoding.

virtual void flush | ( | ByteBuffer & | out | ) |

virtual

Flushes the encoder.

static CharsetEncoderPtr getDefaultEncoder | ( |  | ) |

static

Get encoder for default charset.

static CharsetEncoderPtr getEncoder | ( | const LogString & | charset | ) |

static

Get encoder for specified character set.

Parameters

  charset | the following values should be recognized: "US-ASCII", "ISO-8859-1", "UTF-8", "UTF-16BE", "UTF-16LE".

Returns
  encoder.

Exceptions

  IllegalArgumentException | if encoding is not recognized.

static CharsetEncoderPtr getUTF8Encoder | ( |  | ) |

static

Get encoder for UTF-8.

static bool isError | ( | log4cxx_status_t | stat | ) |

inline static

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

virtual void reset | ( |  | ) |

virtual

Resets any internal state.

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

- charsetencoder.h