Mercurial > 510Connectbot
annotate src/org/tn5250j/encoding/BuiltInCodePageFactory.java @ 303:a218d9cd725b ganymed
add ecdsa key support everywhere
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Tue, 29 Jul 2014 20:24:24 -0700 |
parents | 77ac18bc1b2f |
children |
rev | line source |
---|---|
27
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
1 /** |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
2 * $Id$ |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
3 * |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
4 * Title: tn5250J |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
5 * Copyright: Copyright (c) 2001,2012 |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
6 * Company: |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
7 * @author: master_jaf |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
8 * |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
9 * Description: |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
10 * |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
11 * This program is free software; you can redistribute it and/or modify |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
12 * it under the terms of the GNU General Public License as published by |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
13 * the Free Software Foundation; either version 2, or (at your option) |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
14 * any later version. |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
15 * |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
16 * This program is distributed in the hope that it will be useful, |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
19 * GNU General Public License for more details. |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
20 * |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
21 * You should have received a copy of the GNU General Public License |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
22 * along with this software; see the file COPYING. If not, write to |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
23 * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
24 * Boston, MA 02111-1307 USA |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
25 * |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
26 */ |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
27 package org.tn5250j.encoding; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
28 |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
29 import java.lang.reflect.Constructor; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
30 import java.util.ArrayList; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
31 import java.util.HashSet; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
32 import java.util.List; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
33 |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
34 import org.tn5250j.encoding.builtin.CCSID1025; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
35 import org.tn5250j.encoding.builtin.CCSID1026; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
36 import org.tn5250j.encoding.builtin.CCSID1112; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
37 import org.tn5250j.encoding.builtin.CCSID1140; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
38 import org.tn5250j.encoding.builtin.CCSID1141; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
39 import org.tn5250j.encoding.builtin.CCSID1147; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
40 import org.tn5250j.encoding.builtin.CCSID1148; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
41 import org.tn5250j.encoding.builtin.CCSID273; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
42 import org.tn5250j.encoding.builtin.CCSID277; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
43 import org.tn5250j.encoding.builtin.CCSID278; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
44 import org.tn5250j.encoding.builtin.CCSID280; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
45 import org.tn5250j.encoding.builtin.CCSID284; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
46 import org.tn5250j.encoding.builtin.CCSID285; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
47 import org.tn5250j.encoding.builtin.CCSID297; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
48 import org.tn5250j.encoding.builtin.CCSID37; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
49 import org.tn5250j.encoding.builtin.CCSID424; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
50 import org.tn5250j.encoding.builtin.CCSID500; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
51 import org.tn5250j.encoding.builtin.CCSID870; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
52 import org.tn5250j.encoding.builtin.CCSID871; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
53 import org.tn5250j.encoding.builtin.CCSID875; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
54 import org.tn5250j.encoding.builtin.ICodepageConverter; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
55 import android.util.Log; |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
56 |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
57 |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
58 /** |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
59 * Methods for built-in code page support. |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
60 */ |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
61 class BuiltInCodePageFactory { |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
62 private static final String TAG = "BuiltInCodePageFactory"; |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
63 private static BuiltInCodePageFactory singleton; |
27
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
64 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
65 private final List<Class<?>> clazzes = new ArrayList<Class<?>>(); |
27
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
66 |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
67 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
68 private BuiltInCodePageFactory() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
69 register(); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
70 } |
25
5949eb469a79
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
5
diff
changeset
|
71 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
72 public static synchronized final BuiltInCodePageFactory getInstance() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
73 if (singleton == null) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
74 singleton = new BuiltInCodePageFactory(); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
75 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
76 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
77 return singleton; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
78 } |
27
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
79 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
80 private void register() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
81 clazzes.add(CCSID37.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
82 clazzes.add(CCSID273.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
83 clazzes.add(CCSID277.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
84 clazzes.add(CCSID278.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
85 clazzes.add(CCSID280.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
86 clazzes.add(CCSID284.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
87 clazzes.add(CCSID285.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
88 clazzes.add(CCSID297.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
89 clazzes.add(CCSID424.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
90 clazzes.add(CCSID500.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
91 clazzes.add(CCSID870.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
92 clazzes.add(CCSID871.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
93 clazzes.add(CCSID875.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
94 clazzes.add(CCSID1025.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
95 clazzes.add(CCSID1026.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
96 clazzes.add(CCSID1112.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
97 clazzes.add(CCSID1140.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
98 clazzes.add(CCSID1141.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
99 clazzes.add(CCSID1147.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
100 clazzes.add(CCSID1148.class); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
101 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
102 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
103 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
104 * @return unsorted list of available code pages |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
105 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
106 public String[] getAvailableCodePages() { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
107 HashSet<String> cpset = new HashSet<String>(); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
108 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
109 for (Class<?> clazz : clazzes) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
110 final ICodepageConverter converter = getConverterFromClassName(clazz); |
27
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
111 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
112 if (converter != null) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
113 cpset.add(converter.getName()); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
114 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
115 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
116 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
117 return cpset.toArray(new String[cpset.size()]); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
118 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
119 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
120 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
121 * @param encoding |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
122 * @return an {@link ICodePage} object OR null, of not found |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
123 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
124 public ICodePage getCodePage(String encoding) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
125 for (Class<?> clazz : clazzes) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
126 final ICodepageConverter converter = getConverterFromClassName(clazz); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
127 |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
128 if (converter != null && converter.getName().equals(encoding)) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
129 return converter; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
130 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
131 } |
27
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
132 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
133 return null; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
134 } |
27
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
135 |
112
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
136 /** |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
137 * Lazy loading converters takes time, |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
138 * but doesn't happen so often and saves memory. |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
139 * |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
140 * @param clazz {@link ICodepageConverter} |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
141 * @return |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
142 */ |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
143 private ICodepageConverter getConverterFromClassName(Class<?> clazz) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
144 try { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
145 final Constructor<?> constructor = clazz.getConstructor(new Class[0]); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
146 final ICodepageConverter converter = (ICodepageConverter) constructor.newInstance(); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
147 converter.init(); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
148 return converter; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
149 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
150 catch (Exception e) { |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
151 Log.e(TAG, "Couldn't load code page converter class:" + clazz.getCanonicalName(), e); |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
152 return null; |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
153 } |
77ac18bc1b2f
cleanup java formatting
Carl Byington <carl@five-ten-sg.com>
parents:
27
diff
changeset
|
154 } |
27
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
155 |
b29b39f386a4
adding tn5250 files, native android logging
Carl Byington <carl@five-ten-sg.com>
parents:
25
diff
changeset
|
156 } |