Class ToUnicodeWriter


  • final class ToUnicodeWriter
    extends java.lang.Object
    Writes ToUnicode Mapping Files.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map<java.lang.Integer,​java.lang.String> cidToUnicode  
      (package private) static int MAX_ENTRIES_PER_OPERATOR
      To test corner case of PDFBOX-4302.
      private int wMode  
    • Constructor Summary

      Constructors 
      Constructor Description
      ToUnicodeWriter()
      Creates a new ToUnicode CMap writer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int cid, java.lang.String text)
      Adds the given CID to Unicode mapping.
      void setWMode​(int wMode)
      Sets the WMode (writing mode) of this CMap.
      private void writeLine​(java.io.BufferedWriter writer, java.lang.String text)  
      void writeTo​(java.io.OutputStream out)
      Writes the CMap as ASCII to the given output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • cidToUnicode

        private final java.util.Map<java.lang.Integer,​java.lang.String> cidToUnicode
      • wMode

        private int wMode
      • MAX_ENTRIES_PER_OPERATOR

        static final int MAX_ENTRIES_PER_OPERATOR
        To test corner case of PDFBOX-4302.
        See Also:
        Constant Field Values
    • Constructor Detail

      • ToUnicodeWriter

        ToUnicodeWriter()
        Creates a new ToUnicode CMap writer.
    • Method Detail

      • setWMode

        public void setWMode​(int wMode)
        Sets the WMode (writing mode) of this CMap.
        Parameters:
        wMode - 1 for vertical, 0 for horizontal (default)
      • add

        public void add​(int cid,
                        java.lang.String text)
        Adds the given CID to Unicode mapping.
        Parameters:
        cid - CID
        text - Unicode text, up to 512 bytes.
      • writeTo

        public void writeTo​(java.io.OutputStream out)
                     throws java.io.IOException
        Writes the CMap as ASCII to the given output stream.
        Parameters:
        out - ASCII output stream
        Throws:
        java.io.IOException - if the stream could not be written
      • writeLine

        private void writeLine​(java.io.BufferedWriter writer,
                               java.lang.String text)
                        throws java.io.IOException
        Throws:
        java.io.IOException