public class PerforceCharsets
extends java.lang.Object
Unfortunately, support for Unicode and associated charsets is somewhat server- and installation-dependent, and not easy to divine unless you're already talking to a Perforce server -- by which time it's too late. This class is an attempt to make it easier to cut that Gordian knot...
Note that the names below are not actually the standard name for the charset in some cases: e.g. UTF-8 should be "utf-8" not "utf8", but we follow the Perforce server's rules here.
The following are special cases.
"auto" (Guess a P4CHARSET based on client OS params) "none" (same as unsetting P4CHARSET)
Constructor and Description |
---|
PerforceCharsets() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getJavaCharsetName(java.lang.String p4CharsetName)
Get Java equivalent charset name for a p4 charset name
|
static java.lang.String[] |
getKnownCharsets()
Get known P4 charsets
|
static java.nio.charset.Charset |
getP4Charset(java.lang.String p4CharsetName)
Get the matching Java charset for a given P4 charset name.
|
static java.lang.String |
getP4CharsetName(java.lang.String javaCharsetName)
Get the first matching Perforce equivalent charset name for a given Java
charset name.
|
static boolean |
hasClientBOM(java.lang.String p4CharsetName) |
static boolean |
isSupported(java.lang.String p4CharsetName)
Is the P4 charset name specified supported?
|
public static java.lang.String[] getKnownCharsets()
public static java.lang.String getP4CharsetName(java.lang.String javaCharsetName)
javaCharsetName
- charsetpublic static java.nio.charset.Charset getP4Charset(java.lang.String p4CharsetName)
p4CharsetName
- charsetpublic static java.lang.String getJavaCharsetName(java.lang.String p4CharsetName)
p4CharsetName
- charsetpublic static boolean hasClientBOM(java.lang.String p4CharsetName)
p4CharsetName
- charsetpublic static boolean isSupported(java.lang.String p4CharsetName)
p4CharsetName
- charset