|
20 | 20 |
|
21 | 21 | import java.io.ByteArrayInputStream; |
22 | 22 | import java.io.DataInput; |
23 | | -import java.io.File; |
24 | | -import java.io.FileInputStream; |
25 | 23 | import java.io.IOException; |
26 | 24 | import java.io.InputStream; |
27 | 25 | import java.nio.ByteBuffer; |
28 | 26 | import java.nio.ByteOrder; |
29 | | -import java.nio.IntBuffer; |
30 | 27 | import java.util.ArrayList; |
31 | 28 | import java.util.Arrays; |
32 | 29 | import java.util.List; |
@@ -57,7 +54,7 @@ public class XmlDecompressor { |
57 | 54 |
|
58 | 55 | private static final int RES_XML_RESOURCE_MAP_TYPE = 0x180; |
59 | 56 | private static final int RES_XML_FIRST_CHUNK_TYPE = 0x100; |
60 | | - private static final int REX_XML_STRING_TABLE = 0x0001; |
| 57 | + private static final int RES_XML_STRING_TABLE = 0x0001; |
61 | 58 |
|
62 | 59 | //Resource Types |
63 | 60 | private static final int RES_TYPE_NULL = 0x00; |
@@ -128,7 +125,7 @@ public String decompressXml(byte[] bytes) throws IOException { |
128 | 125 | public String decompressXml(InputStream is) throws IOException { |
129 | 126 | StringBuilder result = new StringBuilder("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); |
130 | 127 | try(LittleEndianDataInputStream dis = new LittleEndianDataInputStream(is)) { |
131 | | - //Getting and checking the marker for a valid XMl file |
| 128 | + //Getting and checking the marker for a valid XML file |
132 | 129 | int fileMarker = dis.readInt(); |
133 | 130 | if (fileMarker != PACKED_XML_IDENTIFIER) { |
134 | 131 | throw new IOException( |
@@ -181,7 +178,7 @@ private void parseCDataTag(StringBuilder sb, DataInput dis, List<String> strings |
181 | 178 | //Skipping 3 unknowns integers: |
182 | 179 | dis.skipBytes(8); |
183 | 180 | int nameStringIndex = dis.readInt(); |
184 | | - //Skipping more 2 unknown integers. |
| 181 | + //Skipping 2 more unknown integers. |
185 | 182 | dis.skipBytes(8); |
186 | 183 |
|
187 | 184 | if (appendCData) { |
@@ -304,7 +301,7 @@ private void parseAttributes(StringBuilder sb, DataInput dis, List<String> strin |
304 | 301 |
|
305 | 302 | private List<String> parseStrings(DataInput dis) throws IOException { |
306 | 303 | int stringMarker = dis.readShort(); |
307 | | - if (stringMarker != REX_XML_STRING_TABLE) { |
| 304 | + if (stringMarker != RES_XML_STRING_TABLE) { |
308 | 305 | throw new IOException( |
309 | 306 | String.format(ERROR_INVALID_MAGIC_NUMBER, |
310 | 307 | PACKED_XML_IDENTIFIER, |
|
0 commit comments