Class StringEscapeUtils.CharSequenceTranslator

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      private java.lang.String translate​(java.lang.CharSequence input)
      Helper for non-Writer usage.
      protected abstract int translate​(java.lang.CharSequence input, int index, java.io.Writer out)
      Translate a set of codepoints, represented by an int index into a CharSequence, into another set of codepoints.
      private void translate​(java.lang.CharSequence input, java.io.Writer out)
      Translate an input onto a Writer.
      • Methods inherited from class java.lang.Object

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

      • CharSequenceTranslator

        private CharSequenceTranslator()
    • Method Detail

      • translate

        protected abstract int translate​(java.lang.CharSequence input,
                                         int index,
                                         java.io.Writer out)
                                  throws java.io.IOException
        Translate a set of codepoints, represented by an int index into a CharSequence, into another set of codepoints. The number of codepoints consumed must be returned, and the only IOExceptions thrown must be from interacting with the Writer so that the top level API may reliably ignore StringWriter IOExceptions.
        Parameters:
        input - CharSequence that is being translated
        index - int representing the current point of translation
        out - Writer to translate the text to
        Returns:
        int count of codepoints consumed
        Throws:
        java.io.IOException - if and only if the Writer produces an IOException
      • translate

        private java.lang.String translate​(java.lang.CharSequence input)
        Helper for non-Writer usage.
        Parameters:
        input - CharSequence to be translated
        Returns:
        String output of translation
      • translate

        private void translate​(java.lang.CharSequence input,
                               java.io.Writer out)
                        throws java.io.IOException
        Translate an input onto a Writer. This is intentionally final as its algorithm is tightly coupled with the abstract method of this class.
        Parameters:
        input - CharSequence that is being translated
        out - Writer to translate the text to
        Throws:
        java.io.IOException - if and only if the Writer produces an IOException