Class B2Utf8Util


  • public class B2Utf8Util
    extends java.lang.Object
    B2Utf8Util has methods that are useful for processing Utf8.
    • Constructor Summary

      Constructors 
      Constructor Description
      B2Utf8Util()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void write​(java.lang.String str, java.io.OutputStream out)
      Writes the characters from str to out encoded as UTF-8.
      static void writeJsonString​(java.lang.CharSequence value, java.io.OutputStream out)
      Writes the characters from str to out encoded as a quoted JSON string.
      • Methods inherited from class java.lang.Object

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

      • B2Utf8Util

        public B2Utf8Util()
    • Method Detail

      • write

        public static void write​(java.lang.String str,
                                 java.io.OutputStream out)
                          throws java.io.IOException
        Writes the characters from str to out encoded as UTF-8.
        Parameters:
        str - the string to convert and write.
        out - the stream to write to
        Throws:
        java.io.IOException - if there's a problem converting to UTF-8 or writing to out. if an exception is thrown, out's state is undefined.
      • writeJsonString

        public static void writeJsonString​(java.lang.CharSequence value,
                                           java.io.OutputStream out)
                                    throws java.io.IOException
        Writes the characters from str to out encoded as a quoted JSON string. This is just like write(), except that it handles ASCII control characters, double-quotes, and backslashes specially.
        Parameters:
        value - the string to convert and write.
        out - the stream to write to
        Throws:
        java.io.IOException - if there's a problem converting to UTF-8 or writing to out. if an exception is thrown, out's state is undefined.