@Test public void testEncodeAddressDisplayName() throws Exception { Assert.assertEquals("\"\"", EncoderUtil.encodeAddressDisplayName("")); Assert.assertEquals("test", EncoderUtil.encodeAddressDisplayName("test")); Assert.assertEquals(" test ", EncoderUtil.encodeAddressDisplayName(" test ")); Assert.assertEquals(" test\ttest ", EncoderUtil .encodeAddressDisplayName(" test\ttest ")); Assert.assertEquals("\"test()\"", EncoderUtil .encodeAddressDisplayName("test()")); Assert.assertEquals("\"John Q. Public\"", EncoderUtil .encodeAddressDisplayName("John Q. Public")); Assert.assertEquals("\"Giant; \\\"Big\\\" Box\"", EncoderUtil .encodeAddressDisplayName("Giant; \"Big\" Box")); Assert.assertEquals("=?ISO-8859-1?Q?Semmelbr=F6sel?=", EncoderUtil .encodeAddressDisplayName("Semmelbr\366sel")); Assert.assertEquals("=?UTF-8?Q?Dollar_=24_Euro_=E2=82=AC?=", EncoderUtil .encodeAddressDisplayName("Dollar $ Euro \u20ac")); }
public static String encodeAddressDisplayName(String displayName) { if (isAtomPhrase(displayName)) { return displayName; } else if (hasToBeEncoded(displayName, 0)) { return encodeEncodedWord(displayName, Usage.WORD_ENTITY); } else { return quote(displayName); } }
EncoderUtil { public static String encodeAddressDisplayName(String displayName) { if (isAtomPhrase(displayName)) { return displayName; } else if (hasToBeEncoded(displayName, 0)) { return encodeEncodedWord(displayName, Usage.WORD_ENTITY); } else { return quote(displayName); } } }
EncoderUtil { public static String encodeAddressDisplayName(String displayName) { if (isAtomPhrase(displayName)) { return displayName; } else if (hasToBeEncoded(displayName, 0)) { return encodeEncodedWord(displayName, Usage.WORD_ENTITY); } else { return quote(displayName); } } private  EncoderUtil(); }
EncoderUtil { public static String encodeAddressDisplayName(String displayName) { if (isAtomPhrase(displayName)) { return displayName; } else if (hasToBeEncoded(displayName, 0)) { return encodeEncodedWord(displayName, Usage.WORD_ENTITY); } else { return quote(displayName); } } private  EncoderUtil(); static String encodeAddressDisplayName(String displayName); static String encodeAddressLocalPart(String localPart); static String encodeHeaderParameter(String name, String value); static String encodeIfNecessary(String text, Usage usage,
            int usedCharacters); static boolean hasToBeEncoded(String text, int usedCharacters); static String encodeEncodedWord(String text, Usage usage); static String encodeEncodedWord(String text, Usage usage,
            int usedCharacters); static String encodeEncodedWord(String text, Usage usage,
            int usedCharacters, Charset charset, Encoding encoding); static String encodeB(byte[] bytes); static String encodeQ(byte[] bytes, Usage usage); static void encodeQBinary(final InputStream in, final OutputStream out); static void encodeQ(final InputStream in, final OutputStream out); static void encodeB(final InputStream in, final OutputStream out); static boolean isToken(String str); }
EncoderUtil { public static String encodeAddressDisplayName(String displayName) { if (isAtomPhrase(displayName)) { return displayName; } else if (hasToBeEncoded(displayName, 0)) { return encodeEncodedWord(displayName, Usage.WORD_ENTITY); } else { return quote(displayName); } } private  EncoderUtil(); static String encodeAddressDisplayName(String displayName); static String encodeAddressLocalPart(String localPart); static String encodeHeaderParameter(String name, String value); static String encodeIfNecessary(String text, Usage usage,
            int usedCharacters); static boolean hasToBeEncoded(String text, int usedCharacters); static String encodeEncodedWord(String text, Usage usage); static String encodeEncodedWord(String text, Usage usage,
            int usedCharacters); static String encodeEncodedWord(String text, Usage usage,
            int usedCharacters, Charset charset, Encoding encoding); static String encodeB(byte[] bytes); static String encodeQ(byte[] bytes, Usage usage); static void encodeQBinary(final InputStream in, final OutputStream out); static void encodeQ(final InputStream in, final OutputStream out); static void encodeB(final InputStream in, final OutputStream out); static boolean isToken(String str);  }