Top Description Fields Constructors Methods
org.apache.fontbox.cmap

public Class CMapStrings

extends Object
Class Inheritance
Imports
java.nio.charset.StandardCharsets, java.util.ArrayList, .List

Many CMaps are using the same values for the mapped strings. This class provides all common one- and two-byte mappings to avoid duplicate strings.

Field Summary

Modifier and TypeField and Description
private static final List<Integer>
private static final List<String>
private static final List<byte[]>
private static final List<String>
private static final List<byte[]>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
public static byte[]

Returns:

a singleton instance for the given combination of bytes
getByteValue
(byte[]
the given combination of bytes
bytes
)

Get a singleton instance of the given combination of bytes to avoid multiple instances for same value.

public static Integer

Returns:

the Integer representation for the given combination of bytes
getIndexValue
(byte[]
the given combination of bytes
bytes
)

Get an Integer instance of the given combination of bytes.

public static String

Returns:

the string representation for the given combination of bytes
getMapping
(byte[]
the given combination of bytes
bytes
)

Get the mapped string value for the given combination of bytes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexValuesback to summary
private static final List<Integer> indexValues
oneByteMappingsback to summary
private static final List<String> oneByteMappings
oneByteValuesback to summary
private static final List<byte[]> oneByteValues
twoByteMappingsback to summary
private static final List<String> twoByteMappings
twoByteValuesback to summary
private static final List<byte[]> twoByteValues

Constructor Detail

CMapStringsback to summary
private CMapStrings()

Method Detail

fillMappingsback to summary
private static void fillMappings()
getByteValueback to summary
public static byte[] getByteValue(byte[] bytes)

Get a singleton instance of the given combination of bytes to avoid multiple instances for same value. The values are limited to one and two-byte sequences. Any longer byte sequence produces null as return value.

Parameters
bytes:byte[]

the given combination of bytes

Returns:byte[]

a singleton instance for the given combination of bytes

getIndexValueback to summary
public static Integer getIndexValue(byte[] bytes)

Get an Integer instance of the given combination of bytes. Each value is a singleton to avoid multiple instances for same value. The values are limited to one and two-byte sequences. Any longer byte sequence produces null as return value.

Parameters
bytes:byte[]

the given combination of bytes

Returns:Integer

the Integer representation for the given combination of bytes

getMappingback to summary
public static String getMapping(byte[] bytes)

Get the mapped string value for the given combination of bytes. The mapping is limited to one and two-byte mappings. Any longer byte sequence produces null as return value.

Parameters
bytes:byte[]

the given combination of bytes

Returns:String

the string representation for the given combination of bytes