summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-09-19 13:00:52 (EDT)
committerEike Stepper2007-09-19 13:00:52 (EDT)
commit82df016701199a4c5742a85021a8fa4353eed0ca (patch)
tree369bcf9bb6eb856a247edaa1121a6a39b64d2efa
parentb953dfcb5052ac9e9236f5c7d0782d5ee47b6767 (diff)
downloadcdo-82df016701199a4c5742a85021a8fa4353eed0ca.zip
cdo-82df016701199a4c5742a85021a8fa4353eed0ca.tar.gz
cdo-82df016701199a4c5742a85021a8fa4353eed0ca.tar.bz2
[203866] Support UTF string
https://bugs.eclipse.org/bugs/show_bug.cgi?id=203866
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/UTFTest.java21
1 files changed, 20 insertions, 1 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/UTFTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/UTFTest.java
index 142bfc9..a009319 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/UTFTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/UTFTest.java
@@ -22,7 +22,7 @@ public class UTFTest extends AbstractOMTest
private static final int MAX = UNSIGNED_SHORT_MAX / 10 + 1;
- public void testUTF8() throws Exception
+ public void testUTF8_OneOctet() throws Exception
{
String part = "0123456789";
assertEquals(10, part.length());
@@ -43,4 +43,23 @@ public class UTFTest extends AbstractOMTest
String received = baos.toString("UTF-8");
assertEquals(str, received);
}
+
+ public void testUTF8_ThreeOctets() throws Exception
+ {
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < UNSIGNED_SHORT_MAX; i++)
+ {
+ builder.append("\u6771");
+ }
+
+ String str = builder.toString();
+ assertEquals(UNSIGNED_SHORT_MAX, str.length());
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ DataOutputStream dos = new DataOutputStream(baos);
+ dos.writeUTF(str);
+
+ String received = baos.toString("UTF-8");
+ assertEquals(str, received);
+ }
}