@Test public void testEncodeHeaderParameter() throws Exception { Assert.assertEquals("p=test", EncoderUtil.encodeHeaderParameter("p", "test")); Assert.assertEquals("p=\"test test\"", EncoderUtil.encodeHeaderParameter("p", "test test")); Assert.assertEquals("p=\"=test\"", EncoderUtil.encodeHeaderParameter("p", "=test")); Assert.assertEquals("p=\"\\\\test\"", EncoderUtil.encodeHeaderParameter("p", "\\test")); Assert.assertEquals("p=\"\\\"\\\\\\\"\"", EncoderUtil.encodeHeaderParameter( "p", "\"\\\"")); }
public static String encodeHeaderParameter(String name, String value) { name = name.toLowerCase(Locale.US); if (isToken(value)) { return name + "=" + value; } else { return name + "=" + quote(value); } }
EncoderUtil { public static String encodeHeaderParameter(String name, String value) { name = name.toLowerCase(Locale.US); if (isToken(value)) { return name + "=" + value; } else { return name + "=" + quote(value); } } }
EncoderUtil { public static String encodeHeaderParameter(String name, String value) { name = name.toLowerCase(Locale.US); if (isToken(value)) { return name + "=" + value; } else { return name + "=" + quote(value); } } private  EncoderUtil(); }
EncoderUtil { public static String encodeHeaderParameter(String name, String value) { name = name.toLowerCase(Locale.US); if (isToken(value)) { return name + "=" + value; } else { return name + "=" + quote(value); } } 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 encodeHeaderParameter(String name, String value) { name = name.toLowerCase(Locale.US); if (isToken(value)) { return name + "=" + value; } else { return name + "=" + quote(value); } } 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);  }