Package com.sun.identity.sm.flatfile
Class FileNameEncoder
- java.lang.Object
-
- com.sun.identity.sm.flatfile.FileNameEncoder
-
public class FileNameEncoder extends Object
Same as URLEncoder except '*' and ' ' are also encoded since they are not acceptable as file names on windows. ' ' is acctually only not acceptable on windows if it's the only character in a file name but we encode it anyway to make things easier. Also, ' ' is not encoded to '+' as it would in URL encoding, and '+' is not encoded. Lastly, '=' is also not encoded since it doesn't need to be and is contained many times in a dn.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
encode(String s)
Translates a string intox-www-form-urlencoded
format with some differences as described at the top of this class.static String
encode(String s, String enc)
Translates a string intoapplication/x-www-form-urlencoded
format using a specific encoding scheme with some differences as described at the top of this class.
-
-
-
Method Detail
-
encode
public static String encode(String s)
Translates a string intox-www-form-urlencoded
format with some differences as described at the top of this class. This method uses UTF-8 as the encoding scheme to obtain the bytes for unsafe characters.- Parameters:
s
-String
to be translated.- Returns:
- the translated
String
.
-
encode
public static String encode(String s, String enc) throws UnsupportedEncodingException
Translates a string intoapplication/x-www-form-urlencoded
format using a specific encoding scheme with some differences as described at the top of this class. This method uses the supplied encoding scheme to obtain the bytes for unsafe characters.Note: The World Wide Web Consortium Recommendation states that UTF-8 should be used. Not doing so may introduce incompatibilites.
- Parameters:
s
-String
to be translated.enc
- The name of a supported character encoding.- Returns:
- the translated
String
. - Throws:
UnsupportedEncodingException
- If the named encoding is not supported- See Also:
FileNameDecoder.decode(java.lang.String, java.lang.String)
-
-