org.apache.pdfbox.encoding.conversion
Class CJKConverter

java.lang.Object
  extended by org.apache.pdfbox.encoding.conversion.CJKConverter
All Implemented Interfaces:
EncodingConverter

public class CJKConverter
extends Object
implements EncodingConverter

CJKConverter converts encodings defined in CJKEncodings.

Version:
$Revision: 1.0 $
Author:
Pin Xue (http://www.pinxue.net), Holly Lee (holly.lee (at) gmail.com)

Constructor Summary
CJKConverter(String encoding)
          Constructs a CJKConverter from a PDF encoding name.
 
Method Summary
 String convertBytes(byte[] c, int offset, int length, org.apache.fontbox.cmap.CMap cmap)
          Convert bytes to a string.
 String convertString(String s)
          Convert a string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CJKConverter

public CJKConverter(String encoding)
Constructs a CJKConverter from a PDF encoding name.

Parameters:
encoding - the encoding to be used
Method Detail

convertString

public String convertString(String s)
Convert a string. It occurs when a cmap lookup returned converted bytes successfully, but we still need to convert its encoding. The parameter s is constructs as one byte or a UTF-16BE encoded string. Note: pdfbox set string to UTF-16BE charset before calling into this. Convert a string.

Specified by:
convertString in interface EncodingConverter
Parameters:
s - the string to be converted
Returns:
the converted string

convertBytes

public String convertBytes(byte[] c,
                           int offset,
                           int length,
                           org.apache.fontbox.cmap.CMap cmap)
Convert bytes to a string. We just convert bytes within coderange defined in CMap. Convert bytes to a string.

Specified by:
convertBytes in interface EncodingConverter
Parameters:
c - the byte array to be converted
offset - the starting offset of the array
length - the number of bytes
cmap - the cmap to be used for conversion
Returns:
the converted string