Skip to content

Commit 12d04af

Browse files
committed
[IO-320] Add XmlStreamReader support for UTF-32. Add DOM data and commented out call sites for UTF-32 BE and LE tests.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/io/trunk@1310328 13f79535-47bb-0310-9956-ffa450edef68
1 parent 2cdbaad commit 12d04af

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/test/java/org/apache/commons/io/input/XmlStreamReaderTest.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ protected void _testRawNoBomInvalid(String encoding) throws Exception {
7474
public void testRawNoBom() throws Exception {
7575
_testRawNoBomValid("US-ASCII");
7676
_testRawNoBomValid("UTF-8");
77+
_testRawNoBomValid("UTF-16BE");
78+
_testRawNoBomValid("UTF-16LE");
79+
//_testRawNoBomValid("UTF-32BE");
80+
//_testRawNoBomValid("UTF-32LE");
7781
_testRawNoBomValid("ISO-8859-1");
7882
_testRawNoBomValid("CP1047");
7983
}
@@ -108,6 +112,8 @@ public void testRawBom() throws Exception {
108112
_testRawBomValid("UTF-8");
109113
_testRawBomValid("UTF-16BE");
110114
_testRawBomValid("UTF-16LE");
115+
//_testRawBomValid("UTF-32BE");
116+
//_testRawBomValid("UTF-32LE");
111117
_testRawBomValid("UTF-16");
112118

113119
_testRawBomInvalid("UTF-8-bom", "US-ASCII", "US-ASCII");
@@ -316,6 +322,8 @@ public void testEncodingAttributeXML() throws Exception {
316322
private static final int[] NO_BOM_BYTES = {};
317323
private static final int[] UTF_16BE_BOM_BYTES = { 0xFE, 0xFF };
318324
private static final int[] UTF_16LE_BOM_BYTES = { 0xFF, 0XFE };
325+
private static final int[] UTF_32BE_BOM_BYTES = { 0x00, 0x00, 0xFE, 0xFF };
326+
private static final int[] UTF_32LE_BOM_BYTES = { 0xFF, 0XFE, 0x00, 0x00 };
319327
private static final int[] UTF_8_BOM_BYTES = { 0xEF, 0xBB, 0xBF };
320328

321329
private static final Map<String, int[]> BOMs = new HashMap<String, int[]>();
@@ -324,6 +332,8 @@ public void testEncodingAttributeXML() throws Exception {
324332
BOMs.put("no-bom", NO_BOM_BYTES);
325333
BOMs.put("UTF-16BE-bom", UTF_16BE_BOM_BYTES);
326334
BOMs.put("UTF-16LE-bom", UTF_16LE_BOM_BYTES);
335+
BOMs.put("UTF-32BE-bom", UTF_32BE_BOM_BYTES);
336+
BOMs.put("UTF-32LE-bom", UTF_32LE_BOM_BYTES);
327337
BOMs.put("UTF-16-bom", NO_BOM_BYTES); // it's added by the writer
328338
BOMs.put("UTF-8-bom", UTF_8_BOM_BYTES);
329339
}

0 commit comments

Comments
 (0)