File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed
fontbox/src/main/java/org/apache/fontbox/cmap Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 1818package org .apache .fontbox .cmap ;
1919
2020import java .nio .charset .StandardCharsets ;
21- import java .util .HashMap ;
22- import java .util .Map ;
21+ import java .util .ArrayList ;
22+ import java .util .List ;
2323
2424/**
2525 * Many CMaps are using the same values for the mapped strings. This class provides all common one- and two-byte
2626 * mappings to avoid duplicate strings.
2727 */
2828public class CMapStrings
2929{
30- private static final Map < Integer , String > twoByteMappings = new HashMap <>();
31- private static final Map < Integer , String > oneByteMappings = new HashMap <>();
30+ private static final List < String > twoByteMappings = new ArrayList <>(256 * 256 );
31+ private static final List < String > oneByteMappings = new ArrayList <>(256 );
3232
3333 static
3434 {
@@ -47,14 +47,13 @@ private static void fillMappings()
4747 for (int j = 0 ; j < 256 ; j ++)
4848 {
4949 byte [] bytes = { (byte ) i , (byte ) j };
50- twoByteMappings .put (CMap .toInt (bytes ),
51- new String (bytes , StandardCharsets .UTF_16BE ));
50+ twoByteMappings .add (new String (bytes , StandardCharsets .UTF_16BE ));
5251 }
5352 }
5453 for (int i = 0 ; i < 256 ; i ++)
5554 {
5655 byte [] bytes = { (byte ) i };
57- oneByteMappings .put ( i , new String (bytes , StandardCharsets .ISO_8859_1 ));
56+ oneByteMappings .add ( new String (bytes , StandardCharsets .ISO_8859_1 ));
5857 }
5958 }
6059
You can’t perform that action at this time.
0 commit comments