Java Code Examples for java.nio.charset.Charset#aliases()
The following examples show how to use
java.nio.charset.Charset#aliases() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EncodingFactory.java From jaybird with GNU Lesser General Public License v2.1 | 6 votes |
private void registerJavaMappingForEncodingDefinition(EncodingDefinition encodingDefinition) { final Charset charset = encodingDefinition.getJavaCharset(); if (encodingDefinition.isInformationOnly() || encodingDefinition.isFirebirdOnly() || charset == null) { return; } final EncodingDefinition currentEncodingDefinition = javaCharsetToDefinition.get(charset); if (currentEncodingDefinition == null) { // Map Java charset to EncodingDefinition javaCharsetToDefinition.put(charset, encodingDefinition); javaAliasesToDefinition.put(charset.name().toLowerCase(), encodingDefinition); for (String charsetAlias : charset.aliases()) { javaAliasesToDefinition.put(charsetAlias.toLowerCase(), encodingDefinition); } } else if (log.isDebugEnabled()) { log.debug(String.format( "Not mapping java charset %s to Firebird encoding %s, already mapped to Firebird encoding %s", charset.name(), encodingDefinition.getEncoding(), currentEncodingDefinition.getFirebirdEncodingName())); } }
Example 2
Source File: InferFileTypeTest.java From p4ic4idea with Apache License 2.0 | 6 votes |
/** * Test printout the JVM's supported charsets. */ @Test public void testPrintoutSupportedCharsets() { SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); }
Example 3
Source File: InferFileTypeTest.java From p4ic4idea with Apache License 2.0 | 6 votes |
/** * Test printout the JVM's supported charsets. */ @Test public void testPrintoutSupportedCharsets() { SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); }
Example 4
Source File: CharsetMapping.java From lams with GNU General Public License v2.0 | 5 votes |
public MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings, ServerVersion minimumVersion) { this.charsetName = charsetName; this.mblen = mblen; this.priority = priority; for (int i = 0; i < javaEncodings.length; i++) { String encoding = javaEncodings[i]; try { Charset cs = Charset.forName(encoding); addEncodingMapping(cs.name()); Set<String> als = cs.aliases(); Iterator<String> ali = als.iterator(); while (ali.hasNext()) { addEncodingMapping(ali.next()); } } catch (Exception e) { // if there is no support of this charset in JVM it's still possible to use our converter for 1-byte charsets if (mblen == 1) { addEncodingMapping(encoding); } } } if (this.javaEncodingsUc.size() == 0) { if (mblen > 1) { addEncodingMapping("UTF-8"); } else { addEncodingMapping("Cp1252"); } } this.minimumVersion = minimumVersion; }
Example 5
Source File: SyncJapaneseFilesCharsetTest.java From p4ic4idea with Apache License 2.0 | 5 votes |
/** * Test printout the JVM's supported charsets. */ @Test public void testPrintoutSupportedCharsets() { SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); }
Example 6
Source File: EncodingFactory.java From jaybird with GNU Lesser General Public License v2.1 | 5 votes |
/** * Set of the charset name and aliases in lower case. * * @param charset Character set * @return Set of lower case names and aliases */ private static Set<String> toLowerCaseAliasSet(final Charset charset) { final Set<String> aliases = charset.aliases(); final Set<String> potentialNames = new HashSet<>(aliases.size() + 1); potentialNames.add(charset.name().toLowerCase()); for (String alias : aliases) { potentialNames.add(alias.toLowerCase()); } return potentialNames; }
Example 7
Source File: SyncJapaneseFilesCharsetTest.java From p4ic4idea with Apache License 2.0 | 5 votes |
/** * Test printout the JVM's supported charsets. */ @Test public void testPrintoutSupportedCharsets() { SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); }
Example 8
Source File: MimeMagic.java From GreasySpoon with GNU Affero General Public License v3.0 | 5 votes |
/** * Build up a list of all system available charsets * @return hash table containing charsets names or aliases, associated to system charset */ private static ConcurrentHashMap<String, String> fetchAvailableCharsets(){ ConcurrentHashMap<String, String> charsetlist = new ConcurrentHashMap<String, String>(); SortedMap<String, Charset> charsets = Charset.availableCharsets(); Set<String> names = charsets.keySet(); //if (debug>2) System.out.println("Available Charsets:"); for (Iterator<String> e = names.iterator(); e.hasNext();) { String name = e.next().toLowerCase().trim(); Charset charset = (Charset) charsets.get(name); if (name==null || charset== null) continue; name = name.trim(); //if (debug>2) System.out.println(charset); charsetlist.put(name, name); Set<String> aliases = charset.aliases(); for (Iterator<String> ee = aliases.iterator(); ee.hasNext();) { try{ String charsetname = ee.next(); if (charsetname==null || charsetname.equals("null")) continue; charsetlist.put(charsetname.toLowerCase().trim(), name); //if (debug>2) System.out.println(" " + charsetname); } catch (Exception e1){ //if (debug>2) e1.printStackTrace(); } } } return charsetlist; }
Example 9
Source File: CharsetMapping.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
public MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings, ServerVersion minimumVersion) { this.charsetName = charsetName; this.mblen = mblen; this.priority = priority; for (int i = 0; i < javaEncodings.length; i++) { String encoding = javaEncodings[i]; try { Charset cs = Charset.forName(encoding); addEncodingMapping(cs.name()); Set<String> als = cs.aliases(); Iterator<String> ali = als.iterator(); while (ali.hasNext()) { addEncodingMapping(ali.next()); } } catch (Exception e) { // if there is no support of this charset in JVM it's still possible to use our converter for 1-byte charsets if (mblen == 1) { addEncodingMapping(encoding); } } } if (this.javaEncodingsUc.size() == 0) { if (mblen > 1) { addEncodingMapping("UTF-8"); } else { addEncodingMapping("Cp1252"); } } this.minimumVersion = minimumVersion; }
Example 10
Source File: CharsetMapping.java From Komondor with GNU General Public License v3.0 | 5 votes |
/** * Constructs MysqlCharset object * * @param charsetName * MySQL charset name * @param mblen * Max number of bytes per character * @param priority * MysqlCharset with highest lever of this param will be used for Java encoding --> Mysql charsets conversion. * @param javaEncodings * List of Java encodings corresponding to this MySQL charset; the first name in list is the default for mysql --> java data conversion */ public MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings) { this.charsetName = charsetName; this.mblen = mblen; this.priority = priority; for (int i = 0; i < javaEncodings.length; i++) { String encoding = javaEncodings[i]; try { Charset cs = Charset.forName(encoding); addEncodingMapping(cs.name()); Set<String> als = cs.aliases(); Iterator<String> ali = als.iterator(); while (ali.hasNext()) { addEncodingMapping(ali.next()); } } catch (Exception e) { // if there is no support of this charset in JVM it's still possible to use our converter for 1-byte charsets if (mblen == 1) { addEncodingMapping(encoding); } } } if (this.javaEncodingsUc.size() == 0) { if (mblen > 1) { addEncodingMapping("UTF-8"); } else { addEncodingMapping("Cp1252"); } } }
Example 11
Source File: CharsetMapping.java From r-course with MIT License | 5 votes |
/** * Constructs MysqlCharset object * * @param charsetName * MySQL charset name * @param mblen * Max number of bytes per character * @param priority * MysqlCharset with highest lever of this param will be used for Java encoding --> Mysql charsets conversion. * @param javaEncodings * List of Java encodings corresponding to this MySQL charset; the first name in list is the default for mysql --> java data conversion */ public MysqlCharset(String charsetName, int mblen, int priority, String[] javaEncodings) { this.charsetName = charsetName; this.mblen = mblen; this.priority = priority; for (int i = 0; i < javaEncodings.length; i++) { String encoding = javaEncodings[i]; try { Charset cs = Charset.forName(encoding); addEncodingMapping(cs.name()); Set<String> als = cs.aliases(); Iterator<String> ali = als.iterator(); while (ali.hasNext()) { addEncodingMapping(ali.next()); } } catch (Exception e) { // if there is no support of this charset in JVM it's still possible to use our converter for 1-byte charsets if (mblen == 1) { addEncodingMapping(encoding); } } } if (this.javaEncodingsUc.size() == 0) { if (mblen > 1) { addEncodingMapping("UTF-8"); } else { addEncodingMapping("Cp1252"); } } }
Example 12
Source File: SyncUtf16leFilesTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
/** * Test sync utf16-le encoded files: UTF-16LE BOM: ff fe */ @Test public void testSyncUtf16leFiles() { String depotFile = null; try { IClient client = server.getClient("p4TestUserWSMac"); assertNotNull(client); server.setCurrentClient(client); SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); depotFile = "//depot/152Bugs/utf16-le/utf16-le_test.txt"; List<IFileSpec> files = client.sync( FileSpecBuilder.makeFileSpecList(depotFile), new SyncOptions().setForceUpdate(true)); assertNotNull(files); } catch (P4JavaException e) { fail("Unexpected exception: " + e.getLocalizedMessage()); } }
Example 13
Source File: SyncUtf16beFilesWinLocalTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
/** * Test sync utf16-le encoded files: UTF-16LE BOM: ff fe */ @Test public void testSyncUtf16leFiles() { String depotFile = null; try { IClient client = server.getClient("p4TestUserWS20112Windows"); server.setCurrentClient(client); SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); depotFile = "//depot/152Bugs/utf16-be/utf16-be.xbit"; List<IFileSpec> files = client.sync( FileSpecBuilder.makeFileSpecList(depotFile), new SyncOptions().setForceUpdate(true)); assertNotNull(files); } catch (P4JavaException e) { fail("Unexpected exception: " + e.getLocalizedMessage()); } }
Example 14
Source File: SyncUtf16leFilesTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
/** * Test sync utf16-le encoded files: UTF-16LE BOM: ff fe */ @Test public void testSyncUtf16leFiles() { String depotFile = null; try { IClient client = server.getClient("p4TestUserWSMac"); assertNotNull(client); server.setCurrentClient(client); SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); depotFile = "//depot/152Bugs/utf16-le/utf16-le_test.txt"; List<IFileSpec> files = client.sync( FileSpecBuilder.makeFileSpecList(depotFile), new SyncOptions().setForceUpdate(true)); assertNotNull(files); } catch (P4JavaException e) { fail("Unexpected exception: " + e.getLocalizedMessage()); } }
Example 15
Source File: SyncUtf16beFilesWinLocalTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
/** * Test sync utf16-le encoded files: UTF-16LE BOM: ff fe */ @Test public void testSyncUtf16leFiles() { String depotFile = null; try { IClient client = server.getClient("p4TestUserWS20112Windows"); server.setCurrentClient(client); SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); depotFile = "//depot/152Bugs/utf16-be/utf16-be.xbit"; List<IFileSpec> files = client.sync( FileSpecBuilder.makeFileSpecList(depotFile), new SyncOptions().setForceUpdate(true)); assertNotNull(files); } catch (P4JavaException e) { fail("Unexpected exception: " + e.getLocalizedMessage()); } }
Example 16
Source File: SyncUtf16beFilesWinLocalTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
/** * Test sync utf16-le encoded files: UTF-16LE BOM: ff fe */ @Test public void testSyncUtf16leFiles() { String depotFile = null; try { IClient client = server.getClient("p4TestUserWS20112Windows"); server.setCurrentClient(client); SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); depotFile = "//depot/152Bugs/utf16-be/utf16-be.xbit"; List<IFileSpec> files = client.sync( FileSpecBuilder.makeFileSpecList(depotFile), new SyncOptions().setForceUpdate(true)); assertNotNull(files); } catch (P4JavaException e) { fail("Unexpected exception: " + e.getLocalizedMessage()); } }
Example 17
Source File: SyncUtf16leFilesTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
/** * Test sync utf16-le encoded files: UTF-16LE BOM: ff fe */ @Test public void testSyncUtf16leFiles() { String depotFile = null; try { IClient client = server.getClient("p4TestUserWSMac"); assertNotNull(client); server.setCurrentClient(client); SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); depotFile = "//depot/152Bugs/utf16-le/utf16-le_test.txt"; List<IFileSpec> files = client.sync( FileSpecBuilder.makeFileSpecList(depotFile), new SyncOptions().setForceUpdate(true)); assertNotNull(files); } catch (P4JavaException e) { fail("Unexpected exception: " + e.getLocalizedMessage()); } }
Example 18
Source File: SyncUtf16beFilesWinLocalTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
/** * Test sync utf16-le encoded files: UTF-16LE BOM: ff fe */ @Test public void testSyncUtf16leFiles() { String depotFile = null; try { IClient client = server.getClient("p4TestUserWS20112Windows"); server.setCurrentClient(client); SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); depotFile = "//depot/152Bugs/utf16-be/utf16-be.xbit"; List<IFileSpec> files = client.sync( FileSpecBuilder.makeFileSpecList(depotFile), new SyncOptions().setForceUpdate(true)); assertNotNull(files); } catch (P4JavaException e) { fail("Unexpected exception: " + e.getLocalizedMessage()); } }
Example 19
Source File: SyncUtf16leFilesTest.java From p4ic4idea with Apache License 2.0 | 4 votes |
/** * Test sync utf16-le encoded files: UTF-16LE BOM: ff fe */ @Test public void testSyncUtf16leFiles() { String depotFile = null; try { IClient client = server.getClient("p4TestUserWSMac"); assertNotNull(client); server.setCurrentClient(client); SortedMap<String, Charset> charsetMap = Charset.availableCharsets(); debugPrint("------------- availableCharsets ----------------"); for (Map.Entry<String, Charset> entry : charsetMap.entrySet()) { String canonicalCharsetName = entry.getKey(); debugPrint(canonicalCharsetName); Charset charset = entry.getValue(); Set<String> aliases = charset.aliases(); for (String alias : aliases) { debugPrint("\t" + alias); } } debugPrint("-----------------------------------------"); String[] perforceCharsets = PerforceCharsets.getKnownCharsets(); debugPrint("------------- perforceCharsets ----------------"); for (String perforceCharset : perforceCharsets) { debugPrint(perforceCharset + " ... " + PerforceCharsets.getJavaCharsetName(perforceCharset)); } debugPrint("-----------------------------------------"); debugPrint("-----------------------------------------"); debugPrint("Charset.defaultCharset().name(): " + Charset.defaultCharset().name()); debugPrint("-----------------------------------------"); depotFile = "//depot/152Bugs/utf16-le/utf16-le_test.txt"; List<IFileSpec> files = client.sync( FileSpecBuilder.makeFileSpecList(depotFile), new SyncOptions().setForceUpdate(true)); assertNotNull(files); } catch (P4JavaException e) { fail("Unexpected exception: " + e.getLocalizedMessage()); } }
Example 20
Source File: CharsetCache.java From Tomcat8-Source-Read with MIT License | 4 votes |
private void addToCache(String name, Charset charset) { cache.put(name, charset); for (String alias : charset.aliases()) { cache.put(alias.toLowerCase(Locale.ENGLISH), charset); } }