Skip to content

Commit 7a8eef9

Browse files
committed
Rename C# keywords
DEVSIX-486
1 parent 98d896c commit 7a8eef9

23 files changed

+530
-554
lines changed

io/src/main/java/com/itextpdf/io/IOException.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ public class IOException extends RuntimeException {
1212
public static final String _1IsNotAValidJpegFile = "{0} is.not.a.valid.jpeg.file";
1313
public static final String _1MustHave8BitsPerComponent = "{0} must.have.8.bits.per.component";
1414
public static final String _1UnsupportedJpegMarker2 = "{0} unsupported.jpeg.marker {1}";
15-
public static final String _1IsNotAnAFMorPfmFontFile = "{0} is.not.an.afm.or.pfm.font.file";
15+
public static final String _1IsNotAnAfmOrPfmFontFile = "{0} is.not.an.afm.or.pfm.font.file";
16+
public static final String _1NotFoundAsFileOrResource = "{0} not found as file or resource.";
1617

1718
public static final String AllFillBitsPrecedingEolCodeMustBe0 = "all.fill.bits.preceding.eol.code.must.be.0";
1819
public static final String BadEndiannessTagNot0x4949Or0x4d4d = "bad.endianness.tag.not.0x4949.or.0x4d4d";
@@ -104,7 +105,7 @@ public class IOException extends RuntimeException {
104105
public static final String UnsupportedBoxSizeEqEq0 = "unsupported.box.size.eq.eq.0";
105106
public static final String WrongNumberOfComponentsInIccProfile = "icc.profile.contains {0} components.the.image.data.contains {2} components";
106107

107-
protected Object object;
108+
protected Object obj;
108109
private List<Object> messageParams;
109110

110111
public IOException(String message) {
@@ -115,18 +116,18 @@ public IOException(Throwable cause) {
115116
super(cause);
116117
}
117118

118-
public IOException(String message, Object object) {
119+
public IOException(String message, Object obj) {
119120
this(message);
120-
this.object = object;
121+
this.obj = obj;
121122
}
122123

123124
public IOException(String message, Throwable cause) {
124125
super(message, cause);
125126
}
126127

127-
public IOException(String message, Throwable cause, Object object) {
128+
public IOException(String message, Throwable cause, Object obj) {
128129
this(message, cause);
129-
this.object = object;
130+
this.obj = obj;
130131
}
131132

132133
@Override

io/src/main/java/com/itextpdf/io/codec/LZWCompressor.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ public class LZWCompressor {
5555
boolean tiffFudge_;
5656

5757
/**
58-
* @param out destination for compressed data
58+
* @param outputStream destination for compressed data
5959
* @param codeSize the initial code size for the LZW compressor
6060
* @param TIFF flag indicating that TIFF lzw fudge needs to be applied
6161
* @throws IOException if underlying output stream error
6262
**/
63-
public LZWCompressor(OutputStream out, int codeSize, boolean TIFF) throws IOException {
64-
bf_ = new BitFile(out, !TIFF); // set flag for GIF as NOT tiff
63+
public LZWCompressor(OutputStream outputStream, int codeSize, boolean TIFF) throws IOException {
64+
bf_ = new BitFile(outputStream, !TIFF); // set flag for GIF as NOT tiff
6565
codeSize_ = codeSize;
6666
tiffFudge_ = TIFF;
6767
clearCode_ = 1 << codeSize_;

io/src/main/java/com/itextpdf/io/codec/LZWStringTable.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ public int expandCode(byte[] buf, int offset, short code, int skipHead) {
177177
return expandLen; // indicate length of dat unpacked
178178
}
179179

180-
public void dump(PrintStream out) {
180+
public void dump(PrintStream output) {
181181
int i;
182182
for (i = 258; i < numStrings_; ++i)
183-
out.println(" strNxt_[" + i + "] = " + strNxt_[i]
183+
output.println(" strNxt_[" + i + "] = " + strNxt_[i]
184184
+ " strChr_ " + Integer.toHexString(strChr_[i] & 0xFF)
185185
+ " strLen_ " + Integer.toHexString(strLen_[i]));
186186
}

io/src/main/java/com/itextpdf/io/codec/TIFFDirectory.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,8 +332,9 @@ private void initialize(RandomAccessFileOrArray stream) throws java.io.IOExcepti
332332
break;
333333

334334
case TIFFField.TIFF_RATIONAL:
335-
long[][] llvalues = new long[count][2];
335+
long[][] llvalues = new long[count][];
336336
for (j = 0; j < count; j++) {
337+
llvalues[j] = new long[2];
337338
llvalues[j][0] = readUnsignedInt(stream);
338339
llvalues[j][1] = readUnsignedInt(stream);
339340
}
@@ -357,8 +358,9 @@ private void initialize(RandomAccessFileOrArray stream) throws java.io.IOExcepti
357358
break;
358359

359360
case TIFFField.TIFF_SRATIONAL:
360-
int[][] iivalues = new int[count][2];
361+
int[][] iivalues = new int[count][];
361362
for (j = 0; j < count; j++) {
363+
iivalues[j] = new int[2];
362364
iivalues[j][0] = readInt(stream);
363365
iivalues[j][1] = readInt(stream);
364366
}

io/src/main/java/com/itextpdf/io/codec/TIFFLZWDecoder.java

Lines changed: 37 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,22 @@
5252
*/
5353
public class TIFFLZWDecoder {
5454

55-
byte stringTable[][];
56-
byte data[] = null, uncompData[];
57-
int tableIndex, bitsToGet = 9;
58-
int bytePointer, bitPointer;
55+
byte[][] stringTable;
56+
byte[] data = null;
57+
byte[] uncompData;
58+
int tableIndex;
59+
int bitsToGet = 9;
60+
int bytePointer;
61+
int bitPointer;
5962
int dstIndex;
60-
int w, h;
61-
int predictor, samplesPerPixel;
63+
int w;
64+
int h;
65+
int predictor;
66+
int samplesPerPixel;
6267
int nextData = 0;
6368
int nextBits = 0;
6469

65-
int andTable[] = {
70+
int[] andTable = {
6671
511,
6772
1023,
6873
2047,
@@ -82,7 +87,7 @@ public TIFFLZWDecoder(int w, int predictor, int samplesPerPixel) {
8287
* @param uncompData Array to return the uncompressed data in.
8388
* @param h The number of rows the compressed data contains.
8489
*/
85-
public byte[] decode(byte data[], byte uncompData[], int h) {
90+
public byte[] decode(byte[] data, byte[] uncompData, int h) {
8691

8792
if (data[0] == (byte) 0x00 && data[1] == (byte) 0x01) {
8893
throw new IOException(IOException.Tiff50StyleLzwCodesAreNotSupported);
@@ -99,59 +104,45 @@ public byte[] decode(byte data[], byte uncompData[], int h) {
99104
bitPointer = 0;
100105
dstIndex = 0;
101106

102-
103107
nextData = 0;
104108
nextBits = 0;
105109

106110
int code, oldCode = 0;
107-
byte string[];
111+
byte[] str;
108112

109113
while (((code = getNextCode()) != 257) &&
110114
dstIndex < uncompData.length) {
111115

112116
if (code == 256) {
113-
114117
initializeStringTable();
115118
code = getNextCode();
116-
117119
if (code == 257) {
118120
break;
119121
}
120-
121122
writeString(stringTable[code]);
122123
oldCode = code;
123124

124125
} else {
125-
126126
if (code < tableIndex) {
127-
128-
string = stringTable[code];
129-
130-
writeString(string);
131-
addStringToTable(stringTable[oldCode], string[0]);
127+
str = stringTable[code];
128+
writeString(str);
129+
addStringToTable(stringTable[oldCode], str[0]);
132130
oldCode = code;
133-
134131
} else {
135-
136-
string = stringTable[oldCode];
137-
string = composeString(string, string[0]);
138-
writeString(string);
139-
addStringToTable(string);
132+
str = stringTable[oldCode];
133+
str = composeString(str, str[0]);
134+
writeString(str);
135+
addStringToTable(str);
140136
oldCode = code;
141137
}
142-
143138
}
144-
145139
}
146140

147141
// Horizontal Differencing Predictor
148142
if (predictor == 2) {
149-
150143
int count;
151144
for (int j = 0; j < h; j++) {
152-
153145
count = samplesPerPixel * (j * w + 1);
154-
155146
for (int i = samplesPerPixel; i < w * samplesPerPixel; i++) {
156147

157148
uncompData[count] += uncompData[count - samplesPerPixel];
@@ -168,7 +159,6 @@ public byte[] decode(byte data[], byte uncompData[], int h) {
168159
* Initialize the string table.
169160
*/
170161
public void initializeStringTable() {
171-
172162
stringTable = new byte[4096][];
173163

174164
for (int i = 0; i < 256; i++) {
@@ -183,26 +173,26 @@ public void initializeStringTable() {
183173
/**
184174
* Write out the string just uncompressed.
185175
*/
186-
public void writeString(byte string[]) {
176+
public void writeString(byte[] str) {
187177
// Fix for broken tiff files
188178
int max = uncompData.length - dstIndex;
189-
if (string.length < max)
190-
max = string.length;
191-
System.arraycopy(string, 0, uncompData, dstIndex, max);
179+
if (str.length < max)
180+
max = str.length;
181+
System.arraycopy(str, 0, uncompData, dstIndex, max);
192182
dstIndex += max;
193183
}
194184

195185
/**
196186
* Add a new string to the string table.
197187
*/
198-
public void addStringToTable(byte oldString[], byte newString) {
188+
public void addStringToTable(byte[] oldString, byte newString) {
199189
int length = oldString.length;
200-
byte string[] = new byte[length + 1];
201-
System.arraycopy(oldString, 0, string, 0, length);
202-
string[length] = newString;
190+
byte[] str = new byte[length + 1];
191+
System.arraycopy(oldString, 0, str, 0, length);
192+
str[length] = newString;
203193

204194
// Add this new String to the table
205-
stringTable[tableIndex++] = string;
195+
stringTable[tableIndex++] = str;
206196

207197
if (tableIndex == 511) {
208198
bitsToGet = 10;
@@ -216,10 +206,10 @@ public void addStringToTable(byte oldString[], byte newString) {
216206
/**
217207
* Add a new string to the string table.
218208
*/
219-
public void addStringToTable(byte string[]) {
209+
public void addStringToTable(byte[] str) {
220210

221211
// Add this new String to the table
222-
stringTable[tableIndex++] = string;
212+
stringTable[tableIndex++] = str;
223213

224214
if (tableIndex == 511) {
225215
bitsToGet = 10;
@@ -233,13 +223,13 @@ public void addStringToTable(byte string[]) {
233223
/**
234224
* Append <code>newString</code> to the end of <code>oldString</code>.
235225
*/
236-
public byte[] composeString(byte oldString[], byte newString) {
226+
public byte[] composeString(byte[] oldString, byte newString) {
237227
int length = oldString.length;
238-
byte string[] = new byte[length + 1];
239-
System.arraycopy(oldString, 0, string, 0, length);
240-
string[length] = newString;
228+
byte[] str = new byte[length + 1];
229+
System.arraycopy(oldString, 0, str, 0, length);
230+
str[length] = newString;
241231

242-
return string;
232+
return str;
243233
}
244234

245235
// Returns the next 9, 10, 11 or 12 bits

io/src/main/java/com/itextpdf/io/font/AdobeGlyphList.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,25 @@ public class AdobeGlyphList {
1414
private static Map<String, Integer> names2unicode = new HashMap<>();
1515

1616
static {
17-
InputStream is = null;
17+
InputStream resource = null;
1818
try {
19-
is = Utilities.getResourceStream(FontsResourceAnchor.ResourcePath + "AdobeGlyphList.txt", FontsResourceAnchor.class.getClassLoader());
20-
if (is == null) {
19+
resource = Utilities.getResourceStream(FontsResourceAnchor.ResourcePath + "AdobeGlyphList.txt", FontsResourceAnchor.class.getClassLoader());
20+
if (resource == null) {
2121
String msg = "AdobeGlyphList.txt not found as resource. (It must exist as resource in the package com.itextpdf.text.pdf.fonts)";
2222
throw new Exception(msg);
2323
}
2424
byte[] buf = new byte[1024];
25-
ByteArrayOutputStream out = new ByteArrayOutputStream();
25+
ByteArrayOutputStream stream = new ByteArrayOutputStream();
2626
while (true) {
27-
int size = is.read(buf);
27+
int size = resource.read(buf);
2828
if (size < 0) {
2929
break;
3030
}
31-
out.write(buf, 0, size);
31+
stream.write(buf, 0, size);
3232
}
33-
is.close();
34-
is = null;
35-
String s = PdfEncodings.convertToString(out.toByteArray(), null);
33+
resource.close();
34+
resource = null;
35+
String s = PdfEncodings.convertToString(stream.toByteArray(), null);
3636
StringTokenizer tk = new StringTokenizer(s, "\r\n");
3737
while (tk.hasMoreTokens()) {
3838
String line = tk.nextToken();
@@ -62,9 +62,9 @@ public class AdobeGlyphList {
6262
} catch (Exception e) {
6363
System.err.println("AdobeGlyphList.txt loading error: " + e.getMessage());
6464
} finally {
65-
if (is != null) {
65+
if (resource != null) {
6666
try {
67-
is.close();
67+
resource.close();
6868
} catch (Exception e) {
6969
// empty on purpose
7070
}

io/src/main/java/com/itextpdf/io/font/CidFontProperties.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ public static Map<String, Set<String>> getRegistryNames() {
6868
}
6969

7070
private static void loadRegistry() throws java.io.IOException {
71-
InputStream is = Utilities.getResourceStream(RESOURCE_PATH_CMAP + "cjk_registry.properties");
71+
InputStream resource = Utilities.getResourceStream(RESOURCE_PATH_CMAP + "cjk_registry.properties");
7272
Properties p = new Properties();
73-
p.load(is);
74-
is.close();
73+
p.load(resource);
74+
resource.close();
7575
for (Object key : p.keySet()) {
7676
String value = p.getProperty((String)key);
7777
String[] sp = value.split(" ");
@@ -86,10 +86,10 @@ private static void loadRegistry() throws java.io.IOException {
8686

8787
private static Map<String, Object> readFontProperties(String name) throws java.io.IOException {
8888
name += ".properties";
89-
InputStream is = Utilities.getResourceStream(RESOURCE_PATH_CMAP + name);
89+
InputStream resource = Utilities.getResourceStream(RESOURCE_PATH_CMAP + name);
9090
Properties p = new Properties();
91-
p.load(is);
92-
is.close();
91+
p.load(resource);
92+
resource.close();
9393
IntHashtable W = createMetric(p.getProperty("W"));
9494
p.remove("W");
9595
IntHashtable W2 = createMetric(p.getProperty("W2"));

io/src/main/java/com/itextpdf/io/font/FontCache.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,10 @@ public static FontProgram saveFont(FontProgram font, String fontName) {
134134
}
135135

136136
private static void loadRegistry() throws java.io.IOException {
137-
InputStream is = Utilities.getResourceStream(CMAP_RESOURCE_PATH + CJK_REGISTRY_FILENAME);
138-
137+
InputStream resource = Utilities.getResourceStream(CMAP_RESOURCE_PATH + CJK_REGISTRY_FILENAME);
139138
try {
140139
Properties p = new Properties();
141-
p.load(is);
140+
p.load(resource);
142141

143142
for (Map.Entry<Object, Object> entry : p.entrySet()) {
144143
String value = (String) entry.getValue();
@@ -154,27 +153,27 @@ private static void loadRegistry() throws java.io.IOException {
154153
registryNames.put((String) entry.getKey(), set);
155154
}
156155
} finally {
157-
if (is != null) {
158-
is.close();
156+
if (resource != null) {
157+
resource.close();
159158
}
160159
}
161160
}
162161

163162
private static Map<String, Object> readFontProperties(String name) throws java.io.IOException {
164-
InputStream is = Utilities.getResourceStream(CMAP_RESOURCE_PATH + name + ".properties");
163+
InputStream resource = Utilities.getResourceStream(CMAP_RESOURCE_PATH + name + ".properties");
165164

166165
try {
167166
Properties p = new Properties();
168-
p.load(is);
167+
p.load(resource);
169168

170169
Map<String, Object> fontProperties = new HashMap<>((Map) p);
171170
fontProperties.put(W_PROP, createMetric((String) fontProperties.get(W_PROP)));
172171
fontProperties.put(W2_PROP, createMetric((String) fontProperties.get(W2_PROP)));
173172

174173
return fontProperties;
175174
} finally {
176-
if (is != null) {
177-
is.close();
175+
if (resource != null) {
176+
resource.close();
178177
}
179178
}
180179
}

0 commit comments

Comments
 (0)