@Test public void quote_surrogate_broken() { char hi = CP_BEER.charAt(0); char lo = CP_BEER.charAt(1); assertThat(TextUtil.quote(String.valueOf(hi)), is(String.format("\"\\u%04x\"", (int) hi))); assertThat(TextUtil.quote(String.valueOf(lo)), is(String.format("\"\\u%04x\"", (int) lo))); assertThat( TextUtil.quote(new StringBuilder().append(hi).append('a')), is(String.format("\"\\u%04xa\"", (int) hi))); }
public static String quote(CharSequence cs) { StringBuilder buf = new StringBuilder(); quoteTo(cs, buf); return buf.toString(); }
TextUtil { public static String quote(CharSequence cs) { StringBuilder buf = new StringBuilder(); quoteTo(cs, buf); return buf.toString(); } }
TextUtil { public static String quote(CharSequence cs) { StringBuilder buf = new StringBuilder(); quoteTo(cs, buf); return buf.toString(); } private  TextUtil(); }
TextUtil { public static String quote(CharSequence cs) { StringBuilder buf = new StringBuilder(); quoteTo(cs, buf); return buf.toString(); } private  TextUtil(); static String quote(CharSequence cs); static void quoteTo(CharSequence cs, StringBuilder target); static int countLeadingWhitespaces(CharSequence cs, int offset, int length); static int countTrailingWhitespaces(CharSequence cs, int offset, int length); static byte parseByte(CharSequence cs, int offset, int length); static short parseShort(CharSequence cs, int offset, int length); static int parseInt(CharSequence cs, int offset, int length); static long parseLong(CharSequence cs, int offset, int length); static BigDecimal parseDecimal(CharSequence cs, int offset, int length); static float parseFloat(CharSequence cs, int offset, int length); static double parseDouble(CharSequence cs, int offset, int length); }
TextUtil { public static String quote(CharSequence cs) { StringBuilder buf = new StringBuilder(); quoteTo(cs, buf); return buf.toString(); } private  TextUtil(); static String quote(CharSequence cs); static void quoteTo(CharSequence cs, StringBuilder target); static int countLeadingWhitespaces(CharSequence cs, int offset, int length); static int countTrailingWhitespaces(CharSequence cs, int offset, int length); static byte parseByte(CharSequence cs, int offset, int length); static short parseShort(CharSequence cs, int offset, int length); static int parseInt(CharSequence cs, int offset, int length); static long parseLong(CharSequence cs, int offset, int length); static BigDecimal parseDecimal(CharSequence cs, int offset, int length); static float parseFloat(CharSequence cs, int offset, int length); static double parseDouble(CharSequence cs, int offset, int length);  }