Class CJKConverter

  • All Implemented Interfaces:
    EncodingConverter

    public class CJKConverter
    extends java.lang.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

      Constructors 
      Constructor Description
      CJKConverter​(java.lang.String encoding)
      Constructs a CJKConverter from a PDF encoding name.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String convertBytes​(byte[] c, int offset, int length, org.apache.fontbox.cmap.CMap cmap)
      Convert bytes to a string.
      java.lang.String convertString​(java.lang.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​(java.lang.String encoding)
        Constructs a CJKConverter from a PDF encoding name.
        Parameters:
        encoding - the encoding to be used
    • Method Detail

      • convertString

        public java.lang.String convertString​(java.lang.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 java.lang.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