PdfEncodings.java

1
/*
2
 * Copyright 2002 Paulo Soares
3
 *
4
 * The contents of this file are subject to the Mozilla Public License Version 1.1
5
 * (the "License"); you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at http://www.mozilla.org/MPL/
7
 *
8
 * Software distributed under the License is distributed on an "AS IS" basis,
9
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10
 * for the specific language governing rights and limitations under the License.
11
 *
12
 * The Original Code is 'iText, a free JAVA-PDF library'.
13
 *
14
 * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
15
 * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
16
 * All Rights Reserved.
17
 * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
18
 * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
19
 *
20
 * Contributor(s): all the names of the contributors are added in the source code
21
 * where applicable.
22
 *
23
 * Alternatively, the contents of this file may be used under the terms of the
24
 * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
25
 * provisions of LGPL are applicable instead of those above.  If you wish to
26
 * allow use of your version of this file only under the terms of the LGPL
27
 * License and not to allow others to use your version of this file under
28
 * the MPL, indicate your decision by deleting the provisions above and
29
 * replace them with the notice and other provisions required by the LGPL.
30
 * If you do not delete the provisions above, a recipient may use your version
31
 * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
32
 *
33
 * This library is free software; you can redistribute it and/or modify it
34
 * under the terms of the MPL as stated above or under the terms of the GNU
35
 * Library General Public License as published by the Free Software Foundation;
36
 * either version 2 of the License, or any later version.
37
 *
38
 * This library is distributed in the hope that it will be useful, but WITHOUT
39
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
40
 * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
41
 * details.
42
 *
43
 * If you didn't download this code from the following link, you should check if
44
 * you aren't using an obsolete version:
45
 * http://www.lowagie.com/iText/
46
 */
47
48
package com.lowagie.text.pdf;
49
50
51
import com.lowagie.text.error_messages.MessageLocalization;
52
import com.lowagie.text.ExceptionConverter;
53
54
import java.io.BufferedReader;
55
import java.io.IOException;
56
import java.io.InputStream;
57
import java.io.InputStreamReader;
58
import java.io.UnsupportedEncodingException;
59
import java.nio.charset.StandardCharsets;
60
import java.util.ArrayList;
61
import java.util.Locale;
62
import java.util.StringTokenizer;
63
import java.util.concurrent.ConcurrentHashMap;
64
65
/**
66
 * Supports fast encodings for winansi and PDFDocEncoding. Supports conversions
67
 * from CJK encodings to CID. Supports custom encodings.
68
 * 
69
 * @author Paulo Soares (psoares@consiste.pt)
70
 */
71
public class PdfEncodings {
72
    protected static final int CIDNONE = 0;
73
    protected static final int CIDRANGE = 1;
74
    protected static final int CIDCHAR = 2;
75
76
    static final char[] winansiByteToChar = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
77
            11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
78
            28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
79
            45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61,
80
            62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
81
            79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
82
            96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109,
83
            110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122,
84
            123, 124, 125, 126, 127, 8364, 65533, 8218, 402, 8222, 8230, 8224,
85
            8225, 710, 8240, 352, 8249, 338, 65533, 381, 65533, 65533, 8216,
86
            8217, 8220, 8221, 8226, 8211, 8212, 732, 8482, 353, 8250, 339,
87
            65533, 382, 376, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169,
88
            170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182,
89
            183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195,
90
            196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208,
91
            209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221,
92
            222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234,
93
            235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247,
94
            248, 249, 250, 251, 252, 253, 254, 255};
95
96
    static final char[] pdfEncodingByteToChar = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9,
97
            10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
98
            27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43,
99
            44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
100
            61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
101
            78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
102
            95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108,
103
            109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121,
104
            122, 123, 124, 125, 126, 127, 0x2022, 0x2020, 0x2021, 0x2026,
105
            0x2014, 0x2013, 0x0192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030,
106
            0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01,
107
            0xfb02, 0x0141, 0x0152, 0x0160, 0x0178, 0x017d, 0x0131, 0x0142,
108
            0x0153, 0x0161, 0x017e, 65533, 0x20ac, 161, 162, 163, 164, 165,
109
            166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178,
110
            179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191,
111
            192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204,
112
            205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217,
113
            218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230,
114
            231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243,
115
            244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255};
116
117
    static final IntHashtable winansi = new IntHashtable();
118
119
    static final IntHashtable pdfEncoding = new IntHashtable();
120
121
    static ConcurrentHashMap<String, ExtraEncoding> extraEncodings = new ConcurrentHashMap<>(
122
            200, 0.85f, 64);
123
124
    static {
125
        for (int k = 128; k < 161; ++k) {
126
            char c = winansiByteToChar[k];
127
            if (c != 65533) {
128
                winansi.put(c, k);
129
            }
130
        }
131
132
        for (int k = 128; k < 161; ++k) {
133
            char c = pdfEncodingByteToChar[k];
134
            if (c != 65533) {
135
                pdfEncoding.put(c, k);
136
            }
137
        }
138
139
        addExtraEncoding("Wingdings", new WingdingsConversion());
140
        addExtraEncoding("Symbol", new SymbolConversion(true));
141
        addExtraEncoding("ZapfDingbats", new SymbolConversion(false));
142
        addExtraEncoding("SymbolTT", new SymbolTTConversion());
143
        addExtraEncoding("Cp437", new Cp437Conversion());
144
    }
145
146
    /**
147
     * Converts a <CODE>String</CODE> to a </CODE>byte</CODE> array according to
148
     * the font's encoding.
149
     * 
150
     * @return an array of <CODE>byte</CODE> representing the conversion
151
     *         according to the font's encoding
152
     * @param encoding
153
     *            the encoding
154
     * @param text
155
     *            the <CODE>String</CODE> to be converted
156
     */
157
    public static final byte[] convertToBytes(String text, String encoding) {
158 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (text == null) {
159 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new byte[0];
160
        }
161 2 1. convertToBytes : negated conditional → NO_COVERAGE
2. convertToBytes : negated conditional → NO_COVERAGE
        if (encoding == null || encoding.length() == 0) {
162
            int len = text.length();
163
            byte[] b = new byte[len];
164 3 1. convertToBytes : changed conditional boundary → NO_COVERAGE
2. convertToBytes : Changed increment from 1 to -1 → NO_COVERAGE
3. convertToBytes : negated conditional → NO_COVERAGE
            for (int k = 0; k < len; ++k) {
165
                b[k] = (byte) text.charAt(k);
166
            }
167 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return b;
168
        }
169
        ExtraEncoding extra = extraEncodings.get(encoding.toLowerCase(Locale.ROOT));
170 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (extra != null) {
171
            byte[] b = extra.charToByte(text, encoding);
172 1 1. convertToBytes : negated conditional → NO_COVERAGE
            if (b != null) {
173 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return b;
174
            }
175
        }
176
        IntHashtable hash = null;
177 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (encoding.equals(BaseFont.WINANSI)) {
178
            hash = winansi;
179 1 1. convertToBytes : negated conditional → NO_COVERAGE
        } else if (encoding.equals(PdfObject.TEXT_PDFDOCENCODING)) {
180
            hash = pdfEncoding;
181
        }
182 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (hash != null) {
183
            char[] cc = text.toCharArray();
184
            int len = cc.length;
185
            int ptr = 0;
186
            byte[] b = new byte[len];
187
            int c = 0;
188
            for (char char1 : cc) {
189 6 1. convertToBytes : changed conditional boundary → NO_COVERAGE
2. convertToBytes : changed conditional boundary → NO_COVERAGE
3. convertToBytes : changed conditional boundary → NO_COVERAGE
4. convertToBytes : negated conditional → NO_COVERAGE
5. convertToBytes : negated conditional → NO_COVERAGE
6. convertToBytes : negated conditional → NO_COVERAGE
                if (char1 < 128 || char1 > 160 && char1 <= 255) {
190
                    c = char1;
191
                } else {
192
                    c = hash.get(char1);
193
                }
194 1 1. convertToBytes : negated conditional → NO_COVERAGE
                if (c != 0) {
195 1 1. convertToBytes : Changed increment from 1 to -1 → NO_COVERAGE
                    b[ptr++] = (byte) c;
196
                }
197
            }
198 1 1. convertToBytes : negated conditional → NO_COVERAGE
            if (ptr == len) {
199 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return b;
200
            }
201
            byte[] b2 = new byte[ptr];
202 1 1. convertToBytes : removed call to java/lang/System::arraycopy → NO_COVERAGE
            System.arraycopy(b, 0, b2, 0, ptr);
203 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return b2;
204
        }
205 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (encoding.equals(PdfObject.TEXT_UNICODE)) {
206
            // workaround for jdk 1.2.2 bug
207
            char[] cc = text.toCharArray();
208
            int len = cc.length;
209 2 1. convertToBytes : Replaced integer multiplication with division → NO_COVERAGE
2. convertToBytes : Replaced integer addition with subtraction → NO_COVERAGE
            byte[] b = new byte[cc.length * 2 + 2];
210
            b[0] = -2;
211
            b[1] = -1;
212
            int bptr = 2;
213
            for (char c : cc) {
214 2 1. convertToBytes : Changed increment from 1 to -1 → NO_COVERAGE
2. convertToBytes : Replaced Shift Right with Shift Left → NO_COVERAGE
                b[bptr++] = (byte) (c >> 8);
215 2 1. convertToBytes : Changed increment from 1 to -1 → NO_COVERAGE
2. convertToBytes : Replaced bitwise AND with OR → NO_COVERAGE
                b[bptr++] = (byte) (c & 0xff);
216
            }
217 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return b;
218
        }
219
        try {
220 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return text.getBytes(encoding);
221
        } catch (UnsupportedEncodingException e) {
222
            throw new ExceptionConverter(e);
223
        }
224
    }
225
226
    /**
227
     * Converts a <CODE>String</CODE> to a </CODE>byte</CODE> array according to
228
     * the font's encoding.
229
     * 
230
     * @return an array of <CODE>byte</CODE> representing the conversion
231
     *         according to the font's encoding
232
     * @param encoding
233
     *            the encoding
234
     * @param char1
235
     *            the <CODE>char</CODE> to be converted
236
     */
237
    public static final byte[] convertToBytes(char char1, String encoding) {
238 2 1. convertToBytes : negated conditional → NO_COVERAGE
2. convertToBytes : negated conditional → NO_COVERAGE
        if (encoding == null || encoding.length() == 0) {
239 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new byte[] { (byte) char1 };
240
        }
241
        ExtraEncoding extra = extraEncodings.get(encoding.toLowerCase(Locale.ROOT));
242 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (extra != null) {
243
            byte[] b = extra.charToByte(char1, encoding);
244 1 1. convertToBytes : negated conditional → NO_COVERAGE
            if (b != null) {
245 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return b;
246
            }
247
        }
248
        IntHashtable hash = null;
249 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (encoding.equals(BaseFont.WINANSI)) {
250
            hash = winansi;
251 1 1. convertToBytes : negated conditional → NO_COVERAGE
        } else if (encoding.equals(PdfObject.TEXT_PDFDOCENCODING)) {
252
            hash = pdfEncoding;
253
        }
254 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (hash != null) {
255
            int c = 0;
256 6 1. convertToBytes : changed conditional boundary → NO_COVERAGE
2. convertToBytes : changed conditional boundary → NO_COVERAGE
3. convertToBytes : changed conditional boundary → NO_COVERAGE
4. convertToBytes : negated conditional → NO_COVERAGE
5. convertToBytes : negated conditional → NO_COVERAGE
6. convertToBytes : negated conditional → NO_COVERAGE
            if (char1 < 128 || char1 > 160 && char1 <= 255) {
257
                c = char1;
258
            } else {
259
                c = hash.get(char1);
260
            }
261 1 1. convertToBytes : negated conditional → NO_COVERAGE
            if (c != 0) {
262 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new byte[] { (byte) c };
263
            } else {
264 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new byte[0];
265
            }
266
        }
267 1 1. convertToBytes : negated conditional → NO_COVERAGE
        if (encoding.equals(PdfObject.TEXT_UNICODE)) {
268
            // workaround for jdk 1.2.2 bug
269
            byte[] b = new byte[4];
270
            b[0] = -2;
271
            b[1] = -1;
272 1 1. convertToBytes : Replaced Shift Right with Shift Left → NO_COVERAGE
            b[2] = (byte) (char1 >> 8);
273 1 1. convertToBytes : Replaced bitwise AND with OR → NO_COVERAGE
            b[3] = (byte) (char1 & 0xff);
274 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return b;
275
        }
276
        try {
277 1 1. convertToBytes : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return String.valueOf(char1).getBytes(encoding);
278
        } catch (UnsupportedEncodingException e) {
279
            throw new ExceptionConverter(e);
280
        }
281
    }
282
283
    /**
284
     * Converts a </CODE>byte</CODE> array to a <CODE>String</CODE> according to
285
     * the some encoding.
286
     * 
287
     * @param bytes
288
     *            the bytes to convert
289
     * @param encoding
290
     *            the encoding
291
     * @return the converted <CODE>String</CODE>
292
     */
293
    public static final String convertToString(byte[] bytes, String encoding) {
294 1 1. convertToString : negated conditional → NO_COVERAGE
        if (bytes == null) {
295 1 1. convertToString : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return PdfObject.NOTHING;
296
        }
297 2 1. convertToString : negated conditional → NO_COVERAGE
2. convertToString : negated conditional → NO_COVERAGE
        if (encoding == null || encoding.length() == 0) {
298
            char[] c = new char[bytes.length];
299 2 1. convertToString : changed conditional boundary → NO_COVERAGE
2. convertToString : negated conditional → NO_COVERAGE
            for (int k = 0; k < bytes.length; ++k) {
300 1 1. convertToString : Replaced bitwise AND with OR → NO_COVERAGE
                c[k] = (char) (bytes[k] & 0xff);
301
            }
302 1 1. convertToString : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new String(c);
303
        }
304
        ExtraEncoding extra = extraEncodings.get(encoding.toLowerCase(Locale.ROOT));
305 1 1. convertToString : negated conditional → NO_COVERAGE
        if (extra != null) {
306
            String text = extra.byteToChar(bytes, encoding);
307 1 1. convertToString : negated conditional → NO_COVERAGE
            if (text != null) {
308 1 1. convertToString : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return text;
309
            }
310
        }
311
        char[] ch = null;
312 1 1. convertToString : negated conditional → NO_COVERAGE
        if (encoding.equals(BaseFont.WINANSI)) {
313
            ch = winansiByteToChar;
314 1 1. convertToString : negated conditional → NO_COVERAGE
        } else if (encoding.equals(PdfObject.TEXT_PDFDOCENCODING)) {
315
            ch = pdfEncodingByteToChar;
316
        }
317 1 1. convertToString : negated conditional → NO_COVERAGE
        if (ch != null) {
318
            int len = bytes.length;
319
            char[] c = new char[len];
320 3 1. convertToString : changed conditional boundary → NO_COVERAGE
2. convertToString : Changed increment from 1 to -1 → NO_COVERAGE
3. convertToString : negated conditional → NO_COVERAGE
            for (int k = 0; k < len; ++k) {
321 1 1. convertToString : Replaced bitwise AND with OR → NO_COVERAGE
                c[k] = ch[bytes[k] & 0xff];
322
            }
323 1 1. convertToString : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new String(c);
324
        }
325
        try {
326 1 1. convertToString : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new String(bytes, encoding);
327
        } catch (UnsupportedEncodingException e) {
328
            throw new ExceptionConverter(e);
329
        }
330
    }
331
332
    /**
333
     * Checks is <CODE>text</CODE> only has PdfDocEncoding characters.
334
     * 
335
     * @param text
336
     *            the <CODE>String</CODE> to test
337
     * @return <CODE>true</CODE> if only PdfDocEncoding characters are present
338
     */
339
    public static boolean isPdfDocEncoding(String text) {
340 1 1. isPdfDocEncoding : negated conditional → NO_COVERAGE
        if (text == null) {
341 1 1. isPdfDocEncoding : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
            return true;
342
        }
343
        int len = text.length();
344 3 1. isPdfDocEncoding : changed conditional boundary → NO_COVERAGE
2. isPdfDocEncoding : Changed increment from 1 to -1 → NO_COVERAGE
3. isPdfDocEncoding : negated conditional → NO_COVERAGE
        for (int k = 0; k < len; ++k) {
345
            char char1 = text.charAt(k);
346 6 1. isPdfDocEncoding : changed conditional boundary → NO_COVERAGE
2. isPdfDocEncoding : changed conditional boundary → NO_COVERAGE
3. isPdfDocEncoding : changed conditional boundary → NO_COVERAGE
4. isPdfDocEncoding : negated conditional → NO_COVERAGE
5. isPdfDocEncoding : negated conditional → NO_COVERAGE
6. isPdfDocEncoding : negated conditional → NO_COVERAGE
            if (char1 < 128 || char1 > 160 && char1 <= 255) {
347
                continue;
348
            }
349 1 1. isPdfDocEncoding : negated conditional → NO_COVERAGE
            if (!pdfEncoding.containsKey(char1)) {
350 1 1. isPdfDocEncoding : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
                return false;
351
            }
352
        }
353 1 1. isPdfDocEncoding : replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE
        return true;
354
    }
355
356
    static final ConcurrentHashMap<String, char[][]> cmaps = new ConcurrentHashMap<>(
357
            100, 0.85f, 64);
358
    /**
359
     * Assumes that '\\n' and '\\r\\n' are the newline sequences. It may not
360
     * work for all CJK encodings. To be used with loadCmap().
361
     */
362
    public static final byte[][] CRLF_CID_NEWLINE = new byte[][]{
363
            {(byte) '\n'}, {(byte) '\r', (byte) '\n'}};
364
365
    /**
366
     * Clears the CJK cmaps from the cache. If <CODE>name</CODE> is the empty
367
     * string then all the cache is cleared. Calling this method has no
368
     * consequences other than the need to reload the cmap if needed.
369
     * 
370
     * @param name
371
     *            the name of the cmap to clear or all the cmaps if the empty
372
     *            string
373
     */
374
    public static void clearCmap(String name) {
375 1 1. clearCmap : negated conditional → NO_COVERAGE
        if (name.length() == 0) {
376 1 1. clearCmap : removed call to java/util/concurrent/ConcurrentHashMap::clear → NO_COVERAGE
            cmaps.clear();
377
        } else {
378
            cmaps.remove(name);
379
        }
380
    }
381
382
    /**
383
     * Loads a CJK cmap to the cache with the option of associating sequences to
384
     * the newline.
385
     * 
386
     * @param name
387
     *            the CJK cmap name
388
     * @param newline
389
     *            the sequences to be replaced by a newline in the resulting
390
     *            CID. See <CODE>CRLF_CID_NEWLINE</CODE>
391
     */
392
    public static void loadCmap(String name, byte[][] newline) {
393
        try {
394
            char[][] planes = null;
395
            planes = cmaps.get(name);
396 1 1. loadCmap : negated conditional → NO_COVERAGE
            if (planes == null) {
397
                planes = readCmap(name, newline);
398
                cmaps.putIfAbsent(name, planes);
399
            }
400
        } catch (IOException e) {
401
            throw new ExceptionConverter(e);
402
        }
403
    }
404
405
    /**
406
     * Converts a <CODE>byte</CODE> array encoded as <CODE>name</CODE> to a CID
407
     * string. This is needed to reach some CJK characters that don't exist in
408
     * 16 bit Unicode.</p> The font to use this result must use the encoding
409
     * "Identity-H" or "Identity-V".</p> See
410
     * ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.
411
     * 
412
     * @param name
413
     *            the CJK encoding name
414
     * @param seq
415
     *            the <CODE>byte</CODE> array to be decoded
416
     * @return the CID string
417
     */
418
    public static String convertCmap(String name, byte[] seq) {
419 1 1. convertCmap : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertCmap to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return convertCmap(name, seq, 0, seq.length);
420
    }
421
422
    /**
423
     * Converts a <CODE>byte</CODE> array encoded as <CODE>name</CODE> to a CID
424
     * string. This is needed to reach some CJK characters that don't exist in
425
     * 16 bit Unicode.</p> The font to use this result must use the encoding
426
     * "Identity-H" or "Identity-V".</p> See
427
     * ftp://ftp.oreilly.com/pub/examples/nutshell/cjkv/adobe/.
428
     * 
429
     * @param name
430
     *            the CJK encoding name
431
     * @param start
432
     *            the start offset in the data
433
     * @param length
434
     *            the number of bytes to convert
435
     * @param seq
436
     *            the <CODE>byte</CODE> array to be decoded
437
     * @return the CID string
438
     */
439
    public static String convertCmap(String name, byte[] seq, int start,
440
                                     int length) {
441
        try {
442
            char[][] planes = null;
443
            planes = cmaps.get(name);
444 1 1. convertCmap : negated conditional → NO_COVERAGE
            if (planes == null) {
445
                planes = readCmap(name, (byte[][]) null);
446
                cmaps.putIfAbsent(name, planes);
447
            }
448 1 1. convertCmap : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertCmap to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return decodeSequence(seq, start, length, planes);
449
        } catch (IOException e) {
450
            throw new ExceptionConverter(e);
451
        }
452
    }
453
454
    static String decodeSequence(byte[] seq, int start, int length,
455
                                 char[][] planes) {
456
        StringBuilder buf = new StringBuilder();
457 1 1. decodeSequence : Replaced integer addition with subtraction → NO_COVERAGE
        int end = start + length;
458
        int currentPlane = 0;
459 3 1. decodeSequence : changed conditional boundary → NO_COVERAGE
2. decodeSequence : Changed increment from 1 to -1 → NO_COVERAGE
3. decodeSequence : negated conditional → NO_COVERAGE
        for (int k = start; k < end; ++k) {
460 1 1. decodeSequence : Replaced bitwise AND with OR → NO_COVERAGE
            int one = seq[k] & 0xff;
461
            char[] plane = planes[currentPlane];
462
            int cid = plane[one];
463 2 1. decodeSequence : Replaced bitwise AND with OR → NO_COVERAGE
2. decodeSequence : negated conditional → NO_COVERAGE
            if ((cid & 0x8000) == 0) {
464
                buf.append((char) cid);
465
                currentPlane = 0;
466
            } else {
467 1 1. decodeSequence : Replaced bitwise AND with OR → NO_COVERAGE
                currentPlane = cid & 0x7fff;
468
            }
469
        }
470 1 1. decodeSequence : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::decodeSequence to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return buf.toString();
471
    }
472
473
    static char[][] readCmap(String name, byte[][] newline) throws IOException {
474
        ArrayList<char[]> planes = new ArrayList<>();
475
        planes.add(new char[256]);
476 1 1. readCmap : removed call to com/lowagie/text/pdf/PdfEncodings::readCmap → NO_COVERAGE
        readCmap(name, planes);
477 1 1. readCmap : negated conditional → NO_COVERAGE
        if (newline != null) {
478
            for (byte[] element : newline) {
479 1 1. readCmap : removed call to com/lowagie/text/pdf/PdfEncodings::encodeSequence → NO_COVERAGE
                encodeSequence(element.length, element, BaseFont.CID_NEWLINE,
480
                        planes);
481
            }
482
        }
483
        char[][] ret = new char[planes.size()][];
484 1 1. readCmap : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::readCmap to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
        return planes.toArray(ret);
485
    }
486
487
    static void readCmap(String name, ArrayList<char[]> planes)
488
            throws IOException {
489
        String fullName = BaseFont.RESOURCE_PATH + "cmaps/" + name;
490
        InputStream in = BaseFont.getResourceStream(fullName);
491 1 1. readCmap : negated conditional → NO_COVERAGE
        if (in == null) {
492
            throw new IOException(MessageLocalization.getComposedMessage(
493
                    "the.cmap.1.was.not.found", name));
494
        }
495 1 1. readCmap : removed call to com/lowagie/text/pdf/PdfEncodings::encodeStream → NO_COVERAGE
        encodeStream(in, planes);
496 1 1. readCmap : removed call to java/io/InputStream::close → NO_COVERAGE
        in.close();
497
    }
498
499
    static void encodeStream(InputStream in, ArrayList<char[]> planes)
500
            throws IOException {
501
        BufferedReader rd = new BufferedReader(new InputStreamReader(in,
502
                StandardCharsets.ISO_8859_1));
503
        String line = null;
504
        int state = CIDNONE;
505
        byte[] seqs = new byte[7];
506 1 1. encodeStream : negated conditional → NO_COVERAGE
        while ((line = rd.readLine()) != null) {
507 2 1. encodeStream : changed conditional boundary → NO_COVERAGE
2. encodeStream : negated conditional → NO_COVERAGE
            if (line.length() < 6) {
508
                continue;
509
            }
510
            switch (state) {
511
            case CIDNONE: {
512 1 1. encodeStream : negated conditional → NO_COVERAGE
                if (line.contains("begincidrange")) {
513
                    state = CIDRANGE;
514 1 1. encodeStream : negated conditional → NO_COVERAGE
                } else if (line.contains("begincidchar")) {
515
                    state = CIDCHAR;
516 1 1. encodeStream : negated conditional → NO_COVERAGE
                } else if (line.contains("usecmap")) {
517
                    StringTokenizer tk = new StringTokenizer(line);
518
                    String t = tk.nextToken();
519 1 1. encodeStream : removed call to com/lowagie/text/pdf/PdfEncodings::readCmap → NO_COVERAGE
                    readCmap(t.substring(1), planes);
520
                }
521
                break;
522
            }
523
            case CIDRANGE: {
524 1 1. encodeStream : negated conditional → NO_COVERAGE
                if (line.contains("endcidrange")) {
525
                    state = CIDNONE;
526
                    break;
527
                }
528
                StringTokenizer tk = new StringTokenizer(line);
529
                String t = tk.nextToken();
530 2 1. encodeStream : Replaced integer division with multiplication → NO_COVERAGE
2. encodeStream : Replaced integer subtraction with addition → NO_COVERAGE
                int size = t.length() / 2 - 1;
531 1 1. encodeStream : Replaced integer subtraction with addition → NO_COVERAGE
                long start = Long.parseLong(t.substring(1, t.length() - 1), 16);
532
                t = tk.nextToken();
533 1 1. encodeStream : Replaced integer subtraction with addition → NO_COVERAGE
                long end = Long.parseLong(t.substring(1, t.length() - 1), 16);
534
                t = tk.nextToken();
535
                int cid = Integer.parseInt(t);
536 3 1. encodeStream : changed conditional boundary → NO_COVERAGE
2. encodeStream : Replaced long addition with subtraction → NO_COVERAGE
3. encodeStream : negated conditional → NO_COVERAGE
                for (long k = start; k <= end; ++k) {
537 1 1. encodeStream : removed call to com/lowagie/text/pdf/PdfEncodings::breakLong → NO_COVERAGE
                    breakLong(k, size, seqs);
538 1 1. encodeStream : removed call to com/lowagie/text/pdf/PdfEncodings::encodeSequence → NO_COVERAGE
                    encodeSequence(size, seqs, (char) cid, planes);
539 1 1. encodeStream : Changed increment from 1 to -1 → NO_COVERAGE
                    ++cid;
540
                }
541
                break;
542
            }
543
            case CIDCHAR: {
544 1 1. encodeStream : negated conditional → NO_COVERAGE
                if (line.contains("endcidchar")) {
545
                    state = CIDNONE;
546
                    break;
547
                }
548
                StringTokenizer tk = new StringTokenizer(line);
549
                String t = tk.nextToken();
550 2 1. encodeStream : Replaced integer division with multiplication → NO_COVERAGE
2. encodeStream : Replaced integer subtraction with addition → NO_COVERAGE
                int size = t.length() / 2 - 1;
551 1 1. encodeStream : Replaced integer subtraction with addition → NO_COVERAGE
                long start = Long.parseLong(t.substring(1, t.length() - 1), 16);
552
                t = tk.nextToken();
553
                int cid = Integer.parseInt(t);
554 1 1. encodeStream : removed call to com/lowagie/text/pdf/PdfEncodings::breakLong → NO_COVERAGE
                breakLong(start, size, seqs);
555 1 1. encodeStream : removed call to com/lowagie/text/pdf/PdfEncodings::encodeSequence → NO_COVERAGE
                encodeSequence(size, seqs, (char) cid, planes);
556
                break;
557
            }
558
            }
559
        }
560
    }
561
562
    static void breakLong(long n, int size, byte[] seqs) {
563 3 1. breakLong : changed conditional boundary → NO_COVERAGE
2. breakLong : Changed increment from 1 to -1 → NO_COVERAGE
3. breakLong : negated conditional → NO_COVERAGE
        for (int k = 0; k < size; ++k) {
564 4 1. breakLong : Replaced integer subtraction with addition → NO_COVERAGE
2. breakLong : Replaced integer subtraction with addition → NO_COVERAGE
3. breakLong : Replaced integer multiplication with division → NO_COVERAGE
4. breakLong : Replaced Shift Right with Shift Left → NO_COVERAGE
            seqs[k] = (byte) (n >> (size - 1 - k) * 8);
565
        }
566
    }
567
568
    static void encodeSequence(int size, byte[] seqs, char cid,
569
                               ArrayList<char[]> planes) {
570 1 1. encodeSequence : Changed increment from -1 to 1 → NO_COVERAGE
        --size;
571
        int nextPlane = 0;
572 3 1. encodeSequence : changed conditional boundary → NO_COVERAGE
2. encodeSequence : Changed increment from 1 to -1 → NO_COVERAGE
3. encodeSequence : negated conditional → NO_COVERAGE
        for (int idx = 0; idx < size; ++idx) {
573
            char[] plane = planes.get(nextPlane);
574 1 1. encodeSequence : Replaced bitwise AND with OR → NO_COVERAGE
            int one = seqs[idx] & 0xff;
575
            char c = plane[one];
576 3 1. encodeSequence : Replaced bitwise AND with OR → NO_COVERAGE
2. encodeSequence : negated conditional → NO_COVERAGE
3. encodeSequence : negated conditional → NO_COVERAGE
            if (c != 0 && (c & 0x8000) == 0) {
577
                throw new RuntimeException(
578
                        MessageLocalization
579
                                .getComposedMessage("inconsistent.mapping"));
580
            }
581 1 1. encodeSequence : negated conditional → NO_COVERAGE
            if (c == 0) {
582
                planes.add(new char[256]);
583 2 1. encodeSequence : Replaced integer subtraction with addition → NO_COVERAGE
2. encodeSequence : Replaced bitwise OR with AND → NO_COVERAGE
                c = (char) (planes.size() - 1 | 0x8000);
584
                plane[one] = c;
585
            }
586 1 1. encodeSequence : Replaced bitwise AND with OR → NO_COVERAGE
            nextPlane = c & 0x7fff;
587
        }
588
        char[] plane = planes.get(nextPlane);
589 1 1. encodeSequence : Replaced bitwise AND with OR → NO_COVERAGE
        int one = seqs[size] & 0xff;
590
        char c = plane[one];
591 2 1. encodeSequence : Replaced bitwise AND with OR → NO_COVERAGE
2. encodeSequence : negated conditional → NO_COVERAGE
        if ((c & 0x8000) != 0) {
592
            throw new RuntimeException(
593
                    MessageLocalization
594
                            .getComposedMessage("inconsistent.mapping"));
595
        }
596
        plane[one] = cid;
597
    }
598
599
    /**
600
     * Adds an extra encoding.
601
     * 
602
     * @param name
603
     *            the name of the encoding. The encoding recognition is case
604
     *            insensitive
605
     * @param enc
606
     *            the conversion class
607
     */
608
    public static void addExtraEncoding(String name, ExtraEncoding enc) {
609
        extraEncodings.putIfAbsent(name.toLowerCase(Locale.ROOT), enc);
610
    }
611
612
    private static class WingdingsConversion implements ExtraEncoding {
613
614
        @Override
615
        public byte[] charToByte(char char1, String encoding) {
616 1 1. charToByte : negated conditional → NO_COVERAGE
            if (char1 == ' ') {
617 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new byte[] { (byte) char1 };
618 4 1. charToByte : changed conditional boundary → NO_COVERAGE
2. charToByte : changed conditional boundary → NO_COVERAGE
3. charToByte : negated conditional → NO_COVERAGE
4. charToByte : negated conditional → NO_COVERAGE
            } else if (char1 >= '\u2701' && char1 <= '\u27BE') {
619 1 1. charToByte : Replaced integer subtraction with addition → NO_COVERAGE
                byte v = table[char1 - 0x2700];
620 1 1. charToByte : negated conditional → NO_COVERAGE
                if (v != 0) {
621 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                    return new byte[] { v };
622
                }
623
            }
624 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new byte[0];
625
        }
626
627
        @Override
628
        public byte[] charToByte(String text, String encoding) {
629
            char[] cc = text.toCharArray();
630
            byte[] b = new byte[cc.length];
631
            int ptr = 0;
632
            int len = cc.length;
633
            for (char c : cc) {
634 1 1. charToByte : negated conditional → NO_COVERAGE
                if (c == ' ') {
635 1 1. charToByte : Changed increment from 1 to -1 → NO_COVERAGE
                    b[ptr++] = (byte) c;
636 4 1. charToByte : changed conditional boundary → NO_COVERAGE
2. charToByte : changed conditional boundary → NO_COVERAGE
3. charToByte : negated conditional → NO_COVERAGE
4. charToByte : negated conditional → NO_COVERAGE
                } else if (c >= '\u2701' && c <= '\u27BE') {
637 1 1. charToByte : Replaced integer subtraction with addition → NO_COVERAGE
                    byte v = table[c - 0x2700];
638 1 1. charToByte : negated conditional → NO_COVERAGE
                    if (v != 0) {
639 1 1. charToByte : Changed increment from 1 to -1 → NO_COVERAGE
                        b[ptr++] = v;
640
                    }
641
                }
642
            }
643 1 1. charToByte : negated conditional → NO_COVERAGE
            if (ptr == len) {
644 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return b;
645
            }
646
            byte[] b2 = new byte[ptr];
647 1 1. charToByte : removed call to java/lang/System::arraycopy → NO_COVERAGE
            System.arraycopy(b, 0, b2, 0, ptr);
648 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return b2;
649
        }
650
651
        @Override
652
        public String byteToChar(byte[] b, String encoding) {
653
            return null;
654
        }
655
656
        private final static byte[] table = {0, 35, 34, 0, 0, 0, 41, 62, 81,
657
                42, 0, 0, 65, 63, 0, 0, 0, 0, 0, -4, 0, 0, 0, -5, 0, 0, 0, 0,
658
                0, 0, 86, 0, 88, 89, 0, 0, 0, 0, 0, 0, 0, 0, -75, 0, 0, 0, 0,
659
                0, -74, 0, 0, 0, -83, -81, -84, 0, 0, 0, 0, 0, 0, 0, 0, 124,
660
                123, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, -90, 0, 0, 0, 113,
661
                114, 0, 0, 0, 117, 0, 0, 0, 0, 0, 0, 125, 126, 0, 0, 0, 0, 0,
662
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -116,
663
                -115, -114, -113, -112, -111, -110, -109, -108, -107, -127,
664
                -126, -125, -124, -123, -122, -121, -120, -119, -118, -116,
665
                -115, -114, -113, -112, -111, -110, -109, -108, -107, -24, 0,
666
                0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -24, -40, 0, 0, -60, -58, 0,
667
                0, -16, 0, 0, 0, 0, 0, 0, 0, 0, 0, -36, 0, 0, 0, 0, 0, 0, 0, 0,
668
                0, 0, 0};
669
    }
670
671
    private static class Cp437Conversion implements ExtraEncoding {
672
        private static IntHashtable c2b = new IntHashtable();
673
674
        @Override
675
        public byte[] charToByte(String text, String encoding) {
676
            char[] cc = text.toCharArray();
677
            byte[] b = new byte[cc.length];
678
            int ptr = 0;
679
            int len = cc.length;
680
            for (char c : cc) {
681 2 1. charToByte : changed conditional boundary → NO_COVERAGE
2. charToByte : negated conditional → NO_COVERAGE
                if (c < 128) {
682 1 1. charToByte : Changed increment from 1 to -1 → NO_COVERAGE
                    b[ptr++] = (byte) c;
683
                } else {
684
                    byte v = (byte) c2b.get(c);
685 1 1. charToByte : negated conditional → NO_COVERAGE
                    if (v != 0) {
686 1 1. charToByte : Changed increment from 1 to -1 → NO_COVERAGE
                        b[ptr++] = v;
687
                    }
688
                }
689
            }
690 1 1. charToByte : negated conditional → NO_COVERAGE
            if (ptr == len) {
691 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return b;
692
            }
693
            byte[] b2 = new byte[ptr];
694 1 1. charToByte : removed call to java/lang/System::arraycopy → NO_COVERAGE
            System.arraycopy(b, 0, b2, 0, ptr);
695 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return b2;
696
        }
697
698
        @Override
699
        public byte[] charToByte(char char1, String encoding) {
700 2 1. charToByte : changed conditional boundary → NO_COVERAGE
2. charToByte : negated conditional → NO_COVERAGE
            if (char1 < 128) {
701 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new byte[] { (byte) char1 };
702
            } else {
703
                byte v = (byte) c2b.get(char1);
704 1 1. charToByte : negated conditional → NO_COVERAGE
                if (v != 0) {
705 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                    return new byte[] { v };
706
                } else {
707 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                    return new byte[0];
708
                }
709
            }
710
        }
711
712
        @Override
713
        public String byteToChar(byte[] b, String encoding) {
714
            int len = b.length;
715
            char[] cc = new char[len];
716
            int ptr = 0;
717
            for (byte b1 : b) {
718 1 1. byteToChar : Replaced bitwise AND with OR → NO_COVERAGE
                int c = b1 & 0xff;
719 2 1. byteToChar : changed conditional boundary → NO_COVERAGE
2. byteToChar : negated conditional → NO_COVERAGE
                if (c < ' ') {
720
                    continue;
721
                }
722 2 1. byteToChar : changed conditional boundary → NO_COVERAGE
2. byteToChar : negated conditional → NO_COVERAGE
                if (c < 128) {
723 1 1. byteToChar : Changed increment from 1 to -1 → NO_COVERAGE
                    cc[ptr++] = (char) c;
724
                } else {
725 1 1. byteToChar : Replaced integer subtraction with addition → NO_COVERAGE
                    char v = table[c - 128];
726 1 1. byteToChar : Changed increment from 1 to -1 → NO_COVERAGE
                    cc[ptr++] = v;
727
                }
728
            }
729 1 1. byteToChar : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::byteToChar to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return new String(cc, 0, ptr);
730
        }
731
732
        private final static char[] table = {'\u00C7', '\u00FC', '\u00E9',
733
                '\u00E2', '\u00E4', '\u00E0', '\u00E5', '\u00E7', '\u00EA',
734
                '\u00EB', '\u00E8', '\u00EF', '\u00EE', '\u00EC', '\u00C4',
735
                '\u00C5', '\u00C9', '\u00E6', '\u00C6', '\u00F4', '\u00F6',
736
                '\u00F2', '\u00FB', '\u00F9', '\u00FF', '\u00D6', '\u00DC',
737
                '\u00A2', '\u00A3', '\u00A5', '\u20A7', '\u0192', '\u00E1',
738
                '\u00ED', '\u00F3', '\u00FA', '\u00F1', '\u00D1', '\u00AA',
739
                '\u00BA', '\u00BF', '\u2310', '\u00AC', '\u00BD', '\u00BC',
740
                '\u00A1', '\u00AB', '\u00BB', '\u2591', '\u2592', '\u2593',
741
                '\u2502', '\u2524', '\u2561', '\u2562', '\u2556', '\u2555',
742
                '\u2563', '\u2551', '\u2557', '\u255D', '\u255C', '\u255B',
743
                '\u2510', '\u2514', '\u2534', '\u252C', '\u251C', '\u2500',
744
                '\u253C', '\u255E', '\u255F', '\u255A', '\u2554', '\u2569',
745
                '\u2566', '\u2560', '\u2550', '\u256C', '\u2567', '\u2568',
746
                '\u2564', '\u2565', '\u2559', '\u2558', '\u2552', '\u2553',
747
                '\u256B', '\u256A', '\u2518', '\u250C', '\u2588', '\u2584',
748
                '\u258C', '\u2590', '\u2580', '\u03B1', '\u00DF', '\u0393',
749
                '\u03C0', '\u03A3', '\u03C3', '\u00B5', '\u03C4', '\u03A6',
750
                '\u0398', '\u03A9', '\u03B4', '\u221E', '\u03C6', '\u03B5',
751
                '\u2229', '\u2261', '\u00B1', '\u2265', '\u2264', '\u2320',
752
                '\u2321', '\u00F7', '\u2248', '\u00B0', '\u2219', '\u00B7',
753
                '\u221A', '\u207F', '\u00B2', '\u25A0', '\u00A0'};
754
755
        static {
756
            for (int k = 0; k < table.length; ++k) {
757
                c2b.put(table[k], k + 128);
758
            }
759
        }
760
    }
761
762
    private static class SymbolConversion implements ExtraEncoding {
763
764
        private static final IntHashtable t1 = new IntHashtable();
765
        private static final IntHashtable t2 = new IntHashtable();
766
        private IntHashtable translation;
767
768
        SymbolConversion(boolean symbol) {
769 1 1. : negated conditional → NO_COVERAGE
            if (symbol) {
770
                translation = t1;
771
            } else {
772
                translation = t2;
773
            }
774
        }
775
776
        @Override
777
        public byte[] charToByte(String text, String encoding) {
778
            char[] cc = text.toCharArray();
779
            byte[] b = new byte[cc.length];
780
            int ptr = 0;
781
            int len = cc.length;
782
            for (char c : cc) {
783
                byte v = (byte) translation.get(c);
784 1 1. charToByte : negated conditional → NO_COVERAGE
                if (v != 0) {
785 1 1. charToByte : Changed increment from 1 to -1 → NO_COVERAGE
                    b[ptr++] = v;
786
                }
787
            }
788 1 1. charToByte : negated conditional → NO_COVERAGE
            if (ptr == len) {
789 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return b;
790
            }
791
            byte[] b2 = new byte[ptr];
792 1 1. charToByte : removed call to java/lang/System::arraycopy → NO_COVERAGE
            System.arraycopy(b, 0, b2, 0, ptr);
793 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return b2;
794
        }
795
796
        @Override
797
        public byte[] charToByte(char char1, String encoding) {
798
            byte v = (byte) translation.get(char1);
799 1 1. charToByte : negated conditional → NO_COVERAGE
            if (v != 0) {
800 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new byte[] { v };
801
            } else {
802 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new byte[0];
803
            }
804
        }
805
806
        @Override
807
        public String byteToChar(byte[] b, String encoding) {
808
            return null;
809
        }
810
811
        private final static char[] table1 = {' ', '!', '\u2200', '#',
812
                '\u2203', '%', '&', '\u220b', '(', ')', '*', '+', ',', '-',
813
                '.', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
814
                ':', ';', '<', '=', '>', '?', '\u2245', '\u0391', '\u0392',
815
                '\u03a7', '\u0394', '\u0395', '\u03a6', '\u0393', '\u0397',
816
                '\u0399', '\u03d1', '\u039a', '\u039b', '\u039c', '\u039d',
817
                '\u039f', '\u03a0', '\u0398', '\u03a1', '\u03a3', '\u03a4',
818
                '\u03a5', '\u03c2', '\u03a9', '\u039e', '\u03a8', '\u0396',
819
                '[', '\u2234', ']', '\u22a5', '_', '\u0305', '\u03b1',
820
                '\u03b2', '\u03c7', '\u03b4', '\u03b5', '\u03d5', '\u03b3',
821
                '\u03b7', '\u03b9', '\u03c6', '\u03ba', '\u03bb', '\u03bc',
822
                '\u03bd', '\u03bf', '\u03c0', '\u03b8', '\u03c1', '\u03c3',
823
                '\u03c4', '\u03c5', '\u03d6', '\u03c9', '\u03be', '\u03c8',
824
                '\u03b6', '{', '|', '}', '~', '\0', '\0', '\0', '\0', '\0',
825
                '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
826
                '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
827
                '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\u20ac',
828
                '\u03d2', '\u2032', '\u2264', '\u2044', '\u221e', '\u0192',
829
                '\u2663', '\u2666', '\u2665', '\u2660', '\u2194', '\u2190',
830
                '\u2191', '\u2192', '\u2193', '\u00b0', '\u00b1', '\u2033',
831
                '\u2265', '\u00d7', '\u221d', '\u2202', '\u2022', '\u00f7',
832
                '\u2260', '\u2261', '\u2248', '\u2026', '\u2502', '\u2500',
833
                '\u21b5', '\u2135', '\u2111', '\u211c', '\u2118', '\u2297',
834
                '\u2295', '\u2205', '\u2229', '\u222a', '\u2283', '\u2287',
835
                '\u2284', '\u2282', '\u2286', '\u2208', '\u2209', '\u2220',
836
                '\u2207', '\u00ae', '\u00a9', '\u2122', '\u220f', '\u221a',
837
                '\u2022', '\u00ac', '\u2227', '\u2228', '\u21d4', '\u21d0',
838
                '\u21d1', '\u21d2', '\u21d3', '\u25ca', '\u2329', '\0', '\0',
839
                '\0', '\u2211', '\u239b', '\u239c', '\u239d', '\u23a1',
840
                '\u23a2', '\u23a3', '\u23a7', '\u23a8', '\u23a9', '\u23aa',
841
                '\0', '\u232a', '\u222b', '\u2320', '\u23ae', '\u2321',
842
                '\u239e', '\u239f', '\u23a0', '\u23a4', '\u23a5', '\u23a6',
843
                '\u23ab', '\u23ac', '\u23ad', '\0'};
844
845
        private final static char[] table2 = {'\u0020', '\u2701', '\u2702',
846
                '\u2703', '\u2704', '\u260e', '\u2706', '\u2707', '\u2708',
847
                '\u2709', '\u261b', '\u261e', '\u270C', '\u270D', '\u270E',
848
                '\u270F', '\u2710', '\u2711', '\u2712', '\u2713', '\u2714',
849
                '\u2715', '\u2716', '\u2717', '\u2718', '\u2719', '\u271A',
850
                '\u271B', '\u271C', '\u271D', '\u271E', '\u271F', '\u2720',
851
                '\u2721', '\u2722', '\u2723', '\u2724', '\u2725', '\u2726',
852
                '\u2727', '\u2605', '\u2729', '\u272A', '\u272B', '\u272C',
853
                '\u272D', '\u272E', '\u272F', '\u2730', '\u2731', '\u2732',
854
                '\u2733', '\u2734', '\u2735', '\u2736', '\u2737', '\u2738',
855
                '\u2739', '\u273A', '\u273B', '\u273C', '\u273D', '\u273E',
856
                '\u273F', '\u2740', '\u2741', '\u2742', '\u2743', '\u2744',
857
                '\u2745', '\u2746', '\u2747', '\u2748', '\u2749', '\u274A',
858
                '\u274B', '\u25cf', '\u274D', '\u25a0', '\u274F', '\u2750',
859
                '\u2751', '\u2752', '\u25b2', '\u25bc', '\u25c6', '\u2756',
860
                '\u25d7', '\u2758', '\u2759', '\u275A', '\u275B', '\u275C',
861
                '\u275D', '\u275E', '\u0000', '\0', '\0', '\0', '\0', '\0',
862
                '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
863
                '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0',
864
                '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\u0000', '\u2761',
865
                '\u2762', '\u2763', '\u2764', '\u2765', '\u2766', '\u2767',
866
                '\u2663', '\u2666', '\u2665', '\u2660', '\u2460', '\u2461',
867
                '\u2462', '\u2463', '\u2464', '\u2465', '\u2466', '\u2467',
868
                '\u2468', '\u2469', '\u2776', '\u2777', '\u2778', '\u2779',
869
                '\u277A', '\u277B', '\u277C', '\u277D', '\u277E', '\u277F',
870
                '\u2780', '\u2781', '\u2782', '\u2783', '\u2784', '\u2785',
871
                '\u2786', '\u2787', '\u2788', '\u2789', '\u278A', '\u278B',
872
                '\u278C', '\u278D', '\u278E', '\u278F', '\u2790', '\u2791',
873
                '\u2792', '\u2793', '\u2794', '\u2192', '\u2194', '\u2195',
874
                '\u2798', '\u2799', '\u279A', '\u279B', '\u279C', '\u279D',
875
                '\u279E', '\u279F', '\u27A0', '\u27A1', '\u27A2', '\u27A3',
876
                '\u27A4', '\u27A5', '\u27A6', '\u27A7', '\u27A8', '\u27A9',
877
                '\u27AA', '\u27AB', '\u27AC', '\u27AD', '\u27AE', '\u27AF',
878
                '\u0000', '\u27B1', '\u27B2', '\u27B3', '\u27B4', '\u27B5',
879
                '\u27B6', '\u27B7', '\u27B8', '\u27B9', '\u27BA', '\u27BB',
880
                '\u27BC', '\u27BD', '\u27BE', '\u0000'};
881
882
        static {
883
            for (int k = 0; k < table1.length; ++k) {
884
                int v = table1[k];
885
                if (v != 0) {
886
                    t1.put(v, k + 32);
887
                }
888
            }
889
            for (int k = 0; k < table2.length; ++k) {
890
                int v = table2[k];
891
                if (v != 0) {
892
                    t2.put(v, k + 32);
893
                }
894
            }
895
        }
896
    }
897
898
    private static class SymbolTTConversion implements ExtraEncoding {
899
900
        @Override
901
        public byte[] charToByte(char char1, String encoding) {
902 4 1. charToByte : Replaced bitwise AND with OR → NO_COVERAGE
2. charToByte : Replaced bitwise AND with OR → NO_COVERAGE
3. charToByte : negated conditional → NO_COVERAGE
4. charToByte : negated conditional → NO_COVERAGE
            if ((char1 & 0xff00) == 0 || (char1 & 0xff00) == 0xf000) {
903 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolTTConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new byte[] { (byte) char1 };
904
            } else {
905 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolTTConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return new byte[0];
906
            }
907
        }
908
909
        @Override
910
        public byte[] charToByte(String text, String encoding) {
911
            char[] ch = text.toCharArray();
912
            byte[] b = new byte[ch.length];
913
            int ptr = 0;
914
            int len = ch.length;
915
            for (char c : ch) {
916 4 1. charToByte : Replaced bitwise AND with OR → NO_COVERAGE
2. charToByte : Replaced bitwise AND with OR → NO_COVERAGE
3. charToByte : negated conditional → NO_COVERAGE
4. charToByte : negated conditional → NO_COVERAGE
                if ((c & 0xff00) == 0 || (c & 0xff00) == 0xf000) {
917 1 1. charToByte : Changed increment from 1 to -1 → NO_COVERAGE
                    b[ptr++] = (byte) c;
918
                }
919
            }
920 1 1. charToByte : negated conditional → NO_COVERAGE
            if (ptr == len) {
921 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolTTConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
                return b;
922
            }
923
            byte[] b2 = new byte[ptr];
924 1 1. charToByte : removed call to java/lang/System::arraycopy → NO_COVERAGE
            System.arraycopy(b, 0, b2, 0, ptr);
925 1 1. charToByte : mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolTTConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE
            return b2;
926
        }
927
928
        @Override
929
        public String byteToChar(byte[] b, String encoding) {
930
            return null;
931
        }
932
933
    }
934
}

Mutations

158

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

159

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

161

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

164

1.1
Location : convertToBytes
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : convertToBytes
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

167

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

170

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

172

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

173

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

177

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

179

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

182

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

189

1.1
Location : convertToBytes
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : convertToBytes
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : convertToBytes
Killed by : none
changed conditional boundary → NO_COVERAGE

4.4
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

6.6
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

194

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

195

1.1
Location : convertToBytes
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

198

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

199

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

202

1.1
Location : convertToBytes
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

203

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

205

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

209

1.1
Location : convertToBytes
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

2.2
Location : convertToBytes
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

214

1.1
Location : convertToBytes
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

2.2
Location : convertToBytes
Killed by : none
Replaced Shift Right with Shift Left → NO_COVERAGE

215

1.1
Location : convertToBytes
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

2.2
Location : convertToBytes
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

217

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

220

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

238

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

239

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

242

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

244

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

245

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

249

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

251

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

254

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

256

1.1
Location : convertToBytes
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : convertToBytes
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : convertToBytes
Killed by : none
changed conditional boundary → NO_COVERAGE

4.4
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

6.6
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

261

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

262

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

264

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

267

1.1
Location : convertToBytes
Killed by : none
negated conditional → NO_COVERAGE

272

1.1
Location : convertToBytes
Killed by : none
Replaced Shift Right with Shift Left → NO_COVERAGE

273

1.1
Location : convertToBytes
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

274

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

277

1.1
Location : convertToBytes
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToBytes to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

294

1.1
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

295

1.1
Location : convertToString
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

297

1.1
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

2.2
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

299

1.1
Location : convertToString
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

300

1.1
Location : convertToString
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

302

1.1
Location : convertToString
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

305

1.1
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

307

1.1
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

308

1.1
Location : convertToString
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

312

1.1
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

314

1.1
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

317

1.1
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

320

1.1
Location : convertToString
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : convertToString
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : convertToString
Killed by : none
negated conditional → NO_COVERAGE

321

1.1
Location : convertToString
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

323

1.1
Location : convertToString
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

326

1.1
Location : convertToString
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertToString to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

340

1.1
Location : isPdfDocEncoding
Killed by : none
negated conditional → NO_COVERAGE

341

1.1
Location : isPdfDocEncoding
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

344

1.1
Location : isPdfDocEncoding
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : isPdfDocEncoding
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : isPdfDocEncoding
Killed by : none
negated conditional → NO_COVERAGE

346

1.1
Location : isPdfDocEncoding
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : isPdfDocEncoding
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : isPdfDocEncoding
Killed by : none
changed conditional boundary → NO_COVERAGE

4.4
Location : isPdfDocEncoding
Killed by : none
negated conditional → NO_COVERAGE

5.5
Location : isPdfDocEncoding
Killed by : none
negated conditional → NO_COVERAGE

6.6
Location : isPdfDocEncoding
Killed by : none
negated conditional → NO_COVERAGE

349

1.1
Location : isPdfDocEncoding
Killed by : none
negated conditional → NO_COVERAGE

350

1.1
Location : isPdfDocEncoding
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

353

1.1
Location : isPdfDocEncoding
Killed by : none
replaced return of integer sized value with (x == 0 ? 1 : 0) → NO_COVERAGE

375

1.1
Location : clearCmap
Killed by : none
negated conditional → NO_COVERAGE

376

1.1
Location : clearCmap
Killed by : none
removed call to java/util/concurrent/ConcurrentHashMap::clear → NO_COVERAGE

396

1.1
Location : loadCmap
Killed by : none
negated conditional → NO_COVERAGE

419

1.1
Location : convertCmap
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertCmap to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

444

1.1
Location : convertCmap
Killed by : none
negated conditional → NO_COVERAGE

448

1.1
Location : convertCmap
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::convertCmap to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

457

1.1
Location : decodeSequence
Killed by : none
Replaced integer addition with subtraction → NO_COVERAGE

459

1.1
Location : decodeSequence
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : decodeSequence
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : decodeSequence
Killed by : none
negated conditional → NO_COVERAGE

460

1.1
Location : decodeSequence
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

463

1.1
Location : decodeSequence
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : decodeSequence
Killed by : none
negated conditional → NO_COVERAGE

467

1.1
Location : decodeSequence
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

470

1.1
Location : decodeSequence
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::decodeSequence to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

476

1.1
Location : readCmap
Killed by : none
removed call to com/lowagie/text/pdf/PdfEncodings::readCmap → NO_COVERAGE

477

1.1
Location : readCmap
Killed by : none
negated conditional → NO_COVERAGE

479

1.1
Location : readCmap
Killed by : none
removed call to com/lowagie/text/pdf/PdfEncodings::encodeSequence → NO_COVERAGE

484

1.1
Location : readCmap
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings::readCmap to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

491

1.1
Location : readCmap
Killed by : none
negated conditional → NO_COVERAGE

495

1.1
Location : readCmap
Killed by : none
removed call to com/lowagie/text/pdf/PdfEncodings::encodeStream → NO_COVERAGE

496

1.1
Location : readCmap
Killed by : none
removed call to java/io/InputStream::close → NO_COVERAGE

506

1.1
Location : encodeStream
Killed by : none
negated conditional → NO_COVERAGE

507

1.1
Location : encodeStream
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : encodeStream
Killed by : none
negated conditional → NO_COVERAGE

512

1.1
Location : encodeStream
Killed by : none
negated conditional → NO_COVERAGE

514

1.1
Location : encodeStream
Killed by : none
negated conditional → NO_COVERAGE

516

1.1
Location : encodeStream
Killed by : none
negated conditional → NO_COVERAGE

519

1.1
Location : encodeStream
Killed by : none
removed call to com/lowagie/text/pdf/PdfEncodings::readCmap → NO_COVERAGE

524

1.1
Location : encodeStream
Killed by : none
negated conditional → NO_COVERAGE

530

1.1
Location : encodeStream
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

2.2
Location : encodeStream
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

531

1.1
Location : encodeStream
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

533

1.1
Location : encodeStream
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

536

1.1
Location : encodeStream
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : encodeStream
Killed by : none
Replaced long addition with subtraction → NO_COVERAGE

3.3
Location : encodeStream
Killed by : none
negated conditional → NO_COVERAGE

537

1.1
Location : encodeStream
Killed by : none
removed call to com/lowagie/text/pdf/PdfEncodings::breakLong → NO_COVERAGE

538

1.1
Location : encodeStream
Killed by : none
removed call to com/lowagie/text/pdf/PdfEncodings::encodeSequence → NO_COVERAGE

539

1.1
Location : encodeStream
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

544

1.1
Location : encodeStream
Killed by : none
negated conditional → NO_COVERAGE

550

1.1
Location : encodeStream
Killed by : none
Replaced integer division with multiplication → NO_COVERAGE

2.2
Location : encodeStream
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

551

1.1
Location : encodeStream
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

554

1.1
Location : encodeStream
Killed by : none
removed call to com/lowagie/text/pdf/PdfEncodings::breakLong → NO_COVERAGE

555

1.1
Location : encodeStream
Killed by : none
removed call to com/lowagie/text/pdf/PdfEncodings::encodeSequence → NO_COVERAGE

563

1.1
Location : breakLong
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : breakLong
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : breakLong
Killed by : none
negated conditional → NO_COVERAGE

564

1.1
Location : breakLong
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : breakLong
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

3.3
Location : breakLong
Killed by : none
Replaced integer multiplication with division → NO_COVERAGE

4.4
Location : breakLong
Killed by : none
Replaced Shift Right with Shift Left → NO_COVERAGE

570

1.1
Location : encodeSequence
Killed by : none
Changed increment from -1 to 1 → NO_COVERAGE

572

1.1
Location : encodeSequence
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : encodeSequence
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

3.3
Location : encodeSequence
Killed by : none
negated conditional → NO_COVERAGE

574

1.1
Location : encodeSequence
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

576

1.1
Location : encodeSequence
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : encodeSequence
Killed by : none
negated conditional → NO_COVERAGE

3.3
Location : encodeSequence
Killed by : none
negated conditional → NO_COVERAGE

581

1.1
Location : encodeSequence
Killed by : none
negated conditional → NO_COVERAGE

583

1.1
Location : encodeSequence
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

2.2
Location : encodeSequence
Killed by : none
Replaced bitwise OR with AND → NO_COVERAGE

586

1.1
Location : encodeSequence
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

589

1.1
Location : encodeSequence
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

591

1.1
Location : encodeSequence
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : encodeSequence
Killed by : none
negated conditional → NO_COVERAGE

616

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

617

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

618

1.1
Location : charToByte
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : charToByte
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

619

1.1
Location : charToByte
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

620

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

621

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

624

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

634

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

635

1.1
Location : charToByte
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

636

1.1
Location : charToByte
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : charToByte
Killed by : none
changed conditional boundary → NO_COVERAGE

3.3
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

637

1.1
Location : charToByte
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

638

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

639

1.1
Location : charToByte
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

643

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

644

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

647

1.1
Location : charToByte
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

648

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$WingdingsConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

681

1.1
Location : charToByte
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

682

1.1
Location : charToByte
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

685

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

686

1.1
Location : charToByte
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

690

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

691

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

694

1.1
Location : charToByte
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

695

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

700

1.1
Location : charToByte
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

701

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

704

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

705

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

707

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

718

1.1
Location : byteToChar
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

719

1.1
Location : byteToChar
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : byteToChar
Killed by : none
negated conditional → NO_COVERAGE

722

1.1
Location : byteToChar
Killed by : none
changed conditional boundary → NO_COVERAGE

2.2
Location : byteToChar
Killed by : none
negated conditional → NO_COVERAGE

723

1.1
Location : byteToChar
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

725

1.1
Location : byteToChar
Killed by : none
Replaced integer subtraction with addition → NO_COVERAGE

726

1.1
Location : byteToChar
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

729

1.1
Location : byteToChar
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$Cp437Conversion::byteToChar to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

769

1.1
Location :
Killed by : none
negated conditional → NO_COVERAGE

784

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

785

1.1
Location : charToByte
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

788

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

789

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

792

1.1
Location : charToByte
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

793

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

799

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

800

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

802

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

902

1.1
Location : charToByte
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : charToByte
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

3.3
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

903

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolTTConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

905

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolTTConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

916

1.1
Location : charToByte
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

2.2
Location : charToByte
Killed by : none
Replaced bitwise AND with OR → NO_COVERAGE

3.3
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

4.4
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

917

1.1
Location : charToByte
Killed by : none
Changed increment from 1 to -1 → NO_COVERAGE

920

1.1
Location : charToByte
Killed by : none
negated conditional → NO_COVERAGE

921

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolTTConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

924

1.1
Location : charToByte
Killed by : none
removed call to java/lang/System::arraycopy → NO_COVERAGE

925

1.1
Location : charToByte
Killed by : none
mutated return of Object value for com/lowagie/text/pdf/PdfEncodings$SymbolTTConversion::charToByte to ( if (x != null) null else throw new RuntimeException ) → NO_COVERAGE

Active mutators

Tests examined


Report generated by PIT 1.4.2