/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
@bug 6346419
@summary Check correctness of the UTF-32 and its variant charsets
*/
public class TestUTF_32 {
byte[] input)
throws Exception
{
}
}
byte[] expected)
throws Exception
{
}
s) ;
}
"obtained char[" + i + "] : " +
}
}
throws Exception
{
if (isBig) {
} else {
}
}
throws Exception
{
if (doBOM)
for (int i = 0; i < 0xffff; i++) {
if (i < Character.MIN_SURROGATE ||
i > Character.MAX_SURROGATE)
}
for (int i = 0x10000; i < 0x1ffff; i++) {
}
for (int i = 0x100000; i < 0x10ffff; i++) {
}
return bb;
}
byte[] bb;
String s;
// Test 1: UTF_32 BigEndian
// Test 2: UTF_32 LittleEndian Decoding With BOM and
// BigEndian Encoding
// Test 3: UTF_32BE
// Test 4: UTF_32LE
// Test 5: UTF_32BE_BOM
// Test 6: UTF_32LE_BOM
s = "\u4e00\ufffd\u4e01";
// Test 7: BigEndian with reverse BOM in middle
bb = new byte[] {
(byte)0x00,(byte)0x00,(byte)0x4e,(byte)0x00,
(byte)0xff,(byte)0xfe,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0x4e,(byte)0x01
};
throw new Exception("UTF_32 Decoding test failed: ");
// Test 7: LittleEndian with reverse BOM in middle
bb = new byte[] {
(byte)0xff,(byte)0xfe,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x4e,(byte)0x00,(byte)0x00,
(byte)0x00,(byte)0x00,(byte)0xfe,(byte)0xff,
(byte)0x01,(byte)0x4e,(byte)0x00,(byte)0x00
};
throw new Exception("UTF_32 Decoding test failed: ");
// Test 8: Overflow
if (CoderResult.OVERFLOW !=
.newDecoder()
.put(new byte[]
{(byte)0,(byte)1, (byte)0,(byte)01})
.flip()),
true)) {
throw new Exception ("Test UTF-32 Overflow test failed");
}
}
}