Mercurial > 510Connectbot
diff src/org/tn5250j/encoding/CharMappings.java @ 112:77ac18bc1b2f
cleanup java formatting
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 18 Jun 2014 13:03:01 -0700 |
parents | cbdff98c45ea |
children |
line wrap: on
line diff
--- a/src/org/tn5250j/encoding/CharMappings.java Wed Jun 18 13:00:19 2014 -0700 +++ b/src/org/tn5250j/encoding/CharMappings.java Wed Jun 18 13:03:01 2014 -0700 @@ -36,50 +36,56 @@ */ public class CharMappings { - public static final String DFT_ENC = "37"; - public static final int NATIVE_CP = 0; - public static final int TOOLBOX_CP = 1; + public static final String DFT_ENC = "37"; + public static final int NATIVE_CP = 0; + public static final int TOOLBOX_CP = 1; - private static final HashMap<String,ICodePage> map = new HashMap<String, ICodePage>(); + private static final HashMap<String, ICodePage> map = new HashMap<String, ICodePage>(); + + public static String[] getAvailableCodePages() { + Set<String> cpset = new HashSet<String>(); // no double entries - public static String[] getAvailableCodePages() { - Set<String> cpset = new HashSet<String>(); // no double entries - for (String cp : BuiltInCodePageFactory.getInstance().getAvailableCodePages()) { - cpset.add(cp); - } - for (String cp : ToolboxCodePageFactory.getInstance().getAvailableCodePages()) { - cpset.add(cp); - } - String[] cparray = cpset.toArray(new String[cpset.size()]); - Arrays.sort(cparray); - return cparray; - } + for (String cp : BuiltInCodePageFactory.getInstance().getAvailableCodePages()) { + cpset.add(cp); + } + + for (String cp : ToolboxCodePageFactory.getInstance().getAvailableCodePages()) { + cpset.add(cp); + } + + String[] cparray = cpset.toArray(new String[cpset.size()]); + Arrays.sort(cparray); + return cparray; + } - public static ICodePage getCodePage(String encoding) { - if (map.containsKey(encoding)) { - return map.get(encoding); - } + public static ICodePage getCodePage(String encoding) { + if (map.containsKey(encoding)) { + return map.get(encoding); + } + + ICodePage cp = BuiltInCodePageFactory.getInstance().getCodePage(encoding); - ICodePage cp = BuiltInCodePageFactory.getInstance().getCodePage(encoding); - if (cp != null) { - map.put(encoding, cp); - return cp; - } + if (cp != null) { + map.put(encoding, cp); + return cp; + } + + cp = ToolboxCodePageFactory.getInstance().getCodePage(encoding); - cp = ToolboxCodePageFactory.getInstance().getCodePage(encoding); - if (cp != null) { - map.put(encoding, cp); - return cp; - } + if (cp != null) { + map.put(encoding, cp); + return cp; + } + + cp = JavaCodePageFactory.getCodePage(encoding); - cp = JavaCodePageFactory.getCodePage(encoding); - if (cp != null) { - map.put(encoding, cp); - return cp; - } + if (cp != null) { + map.put(encoding, cp); + return cp; + } - // unsupported codepage ==> return default - return BuiltInCodePageFactory.getInstance().getCodePage(DFT_ENC); - } + // unsupported codepage ==> return default + return BuiltInCodePageFactory.getInstance().getCodePage(DFT_ENC); + } }