@Inline public static void toUTF8(String s,ByteBuffer b){
  int result_index=0;
  for (int i=0, n=s.length(); i < n; ++i) {
    char c=s.charAt(i);
    if (((!WRITE_PSEUDO_UTF8) || (c >= 0x0001)) && (c <= 0x007F)) {
      b.put((byte)c);
    }
 else     if (c > 0x07FF) {
      b.put((byte)(0xe0 | (byte)(c >> 12)));
      b.put((byte)(0x80 | ((c & 0xfc0) >> 6)));
      b.put((byte)(0x80 | (c & 0x3f)));
    }
 else {
      b.put((byte)(0xc0 | (byte)(c >> 6)));
      b.put((byte)(0x80 | (c & 0x3f)));
    }
  }
}

@ Inline public static void toUTF8 ( String s , ByteBuffer b ) { int result_index = 0 ; for ( int i = 0 , n = s . length ( ) ; i < n ; ++ i ) { char c = s . charAt ( i ) ; if ( ( ( ! WRITE_PSEUDO_UTF8 ) || ( c >= 0x0001 ) ) && ( c <= 0x007F ) ) { b . put ( ( byte ) c ) ; } else if ( c > 0x07FF ) { b . put ( ( byte ) ( 0xe0 | ( byte ) ( c > > 12 ) ) ) ; b . put ( ( byte ) ( 0x80 | ( ( c & 0xfc0 ) > > 6 ) ) ) ; b . put ( ( byte ) ( 0x80 | ( c & 0x3f ) ) ) ; } else { b . put ( ( byte ) ( 0xc0 | ( byte ) ( c > > 6 ) ) ) ; b . put ( ( byte ) ( 0x80 | ( c & 0x3f ) ) ) ; } } }
convert the given string into a sequence of ( pseudo - ) utf8 formatted bytes . < p > the output format is controlled by the write_pseudo_utf8 flag .
