/** Add multiple mappings at once for a particular index. */ @CanIgnoreReturnValue public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }
/** * Convert this builder into a char escaper which is just a decorator around the underlying array * of replacement char[]s. * * @return an escaper that escapes based on the underlying array. */ public Escaper toEscaper() { return new CharArrayDecorator(toArray()); } }
public void testAddEscapes() { char[] cs = {'a', 'b', 'c'}; CharEscaperBuilder builder = new CharEscaperBuilder().addEscapes(cs, "Z"); Escaper escaper = builder.toEscaper(); assertEquals("ZZZdef", escaper.escape("abcdef")); } }
private static Escaper newEscaper(String unwiseChars) { if (isNullOrEmpty(unwiseChars)) { return nullEscaper(); } Iterable<String> tokens = Splitter.on(",").omitEmptyStrings().split(unwiseChars); CharEscaperBuilder builder = new CharEscaperBuilder(); for (String token : tokens) { char c = token.charAt(0); builder.addEscape(c, "%" + toHexString(c).toUpperCase()); } return builder.toEscaper(); } }
/** Add multiple mappings at once for a particular index. */ @CanIgnoreReturnValue public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }
/** * Convert this builder into a char escaper which is just a decorator around the underlying array * of replacement char[]s. * * @return an escaper that escapes based on the underlying array. */ public Escaper toEscaper() { return new CharArrayDecorator(toArray()); } }
public void testAddEscapes() { char[] cs = {'a', 'b', 'c'}; CharEscaperBuilder builder = new CharEscaperBuilder().addEscapes(cs, "Z"); Escaper escaper = builder.toEscaper(); assertEquals("ZZZdef", escaper.escape("abcdef")); }
/** Add multiple mappings at once for a particular index. */ @CanIgnoreReturnValue public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }
/** * Convert this builder into a char escaper which is just a decorator around the underlying array * of replacement char[]s. * * @return an escaper that escapes based on the underlying array. */ public Escaper toEscaper() { return new CharArrayDecorator(toArray()); } }
/** * Add multiple mappings at once for a particular index. */ public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }
/** * Convert this builder into a char escaper which is just a decorator around the underlying array * of replacement char[]s. * * @return an escaper that escapes based on the underlying array. */ public Escaper toEscaper() { return new CharArrayDecorator(toArray()); } }
/** * Add multiple mappings at once for a particular index. */ public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }
/** * Convert this builder into a char escaper which is just a decorator around the underlying array * of replacement char[]s. * * @return an escaper that escapes based on the underlying array. */ public Escaper toEscaper() { return new CharArrayDecorator(toArray()); } }
/** * Add multiple mappings at once for a particular index. */ public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }
/** * Convert this builder into a char escaper which is just a decorator around the underlying array * of replacement char[]s. * * @return an escaper that escapes based on the underlying array. */ public Escaper toEscaper() { return new CharArrayDecorator(toArray()); } }
/** * Add multiple mappings at once for a particular index. */ public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }
/** * Convert this builder into a char escaper which is just a decorator around the underlying array * of replacement char[]s. * * @return an escaper that escapes based on the underlying array. */ public Escaper toEscaper() { return new CharArrayDecorator(toArray()); } }
/** * Add multiple mappings at once for a particular index. */ public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }
/** * Convert this builder into a char escaper which is just a decorator around the underlying array * of replacement char[]s. * * @return an escaper that escapes based on the underlying array. */ public Escaper toEscaper() { return new CharArrayDecorator(toArray()); } }
/** * Add multiple mappings at once for a particular index. */ public CharEscaperBuilder addEscapes(char[] cs, String r) { checkNotNull(r); for (char c : cs) { addEscape(c, r); } return this; }