Class StringRenderBuilder


  • public class StringRenderBuilder
    extends java.lang.Object
    Helper class used to build up a formatted (for human consumption) string representation returned by Unicode and String data types.

    Call toString() to retrieve the formatted string.

    Example (quotes are part of result): "Test\tstring",01,02,"Second\npart",00

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addByteSeq​(byte[] bytes)
      Add byte values, shown as numeric hex values.
      void addCodePointChar​(int codePoint)
      Add a single character.
      void addCodePointValue​(int codePoint)
      Add a single character that needs to be shown as a numeric hex value.
      void addEscapedChar​(char ch)
      Append the specified char after an escaping backslash "\", ie "x" -> "\x";
      void addEscapedCodePoint​(int codePoint)
      Add an unicode codepoint as its escaped hex value, with a escape character prefix of 'x', 'u' or 'U' depending on the magnitude of the codePoint value.
      void addString​(java.lang.String str)
      Append the characters in the specified string.
      java.lang.String toString()
      Example (quotes are part of result): "Test\tstring",01,02,"Second\npart",00
      • Methods inherited from class java.lang.Object

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

      • StringRenderBuilder

        public StringRenderBuilder​(int charSize)
      • StringRenderBuilder

        public StringRenderBuilder​(int charSize,
                                   char quoteChar)
    • Method Detail

      • addString

        public void addString​(java.lang.String str)
        Append the characters in the specified string. The added characters will be shown in a quoted text region.
        Parameters:
        str - String to add
      • addEscapedChar

        public void addEscapedChar​(char ch)
        Append the specified char after an escaping backslash "\", ie "x" -> "\x";
        Parameters:
        ch -
      • addCodePointChar

        public void addCodePointChar​(int codePoint)
        Add a single character. It will be shown in a quoted text region.
        Parameters:
        codePoint - Character to add
      • addCodePointValue

        public void addCodePointValue​(int codePoint)
        Add a single character that needs to be shown as a numeric hex value.
        Parameters:
        codePoint - Character to add
      • addByteSeq

        public void addByteSeq​(byte[] bytes)
        Add byte values, shown as numeric hex values.

        { 0, 1, 2 } -> 00,01,02

        Parameters:
        bytes -
      • addEscapedCodePoint

        public void addEscapedCodePoint​(int codePoint)
        Add an unicode codepoint as its escaped hex value, with a escape character prefix of 'x', 'u' or 'U' depending on the magnitude of the codePoint value.

        codePoint 15 -> '\' 'x' "0F"
        codePoint 65535 -> '\' 'u' "FFFF"
        codePoint 65536 -> '\' 'U' "10000"

        Parameters:
        codePoint - int value
      • toString

        public java.lang.String toString()
        Example (quotes are part of result): "Test\tstring",01,02,"Second\npart",00

        Overrides:
        toString in class java.lang.Object
        Returns:
        Formatted string