diff --git a/.classpath b/.classpath deleted file mode 100644 index 58a367f..0000000 --- a/.classpath +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/.idea/misc.xml b/.idea/misc.xml index e5c7225..bb3224a 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -2,5 +2,8 @@ - + + + + \ No newline at end of file diff --git a/.project b/.project deleted file mode 100644 index 147cb77..0000000 --- a/.project +++ /dev/null @@ -1,23 +0,0 @@ - - - kson - Project kson created by Buildship. - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.buildship.core.gradleprojectbuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.buildship.core.gradleprojectnature - - diff --git a/build.gradle b/build.gradle index 89bc024..1249481 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ task fatJar(type: Jar) { } dependencies { - implementation 'com.github.realtimetech-solution:reflection:0.2.4' + implementation 'com.github.realtimetech-solution:reflection:0.2.7' } jar { diff --git a/src/main/java/com/realtimetech/kson/KsonContext.java b/src/main/java/com/realtimetech/kson/KsonContext.java index b0e2904..3d89f04 100644 --- a/src/main/java/com/realtimetech/kson/KsonContext.java +++ b/src/main/java/com/realtimetech/kson/KsonContext.java @@ -881,6 +881,24 @@ public JsonValue fromString(String kson) throws IOException { case '\\': this.stringMaker.add('\\'); break; + case 'u': + char result = 0; + for(int i = 2; i <= 5; i++){ + char c = charArray[pointer + i]; + result <<= 4; + if (c >= '0' && c <= '9') { + result += (c - '0'); + } else if (c >= 'a' && c <= 'f') { + result += (c - 'a' + 10); + } else if (c >= 'A' && c <= 'F') { + result += (c - 'A' + 10); + } else { + throw new IOException("An exception occurred at " + (pointer - 1) + " position character(" + charArray[(pointer - 1)] + ")"); + } + } + pointer+=4; + this.stringMaker.add(result); + break; case 'b': this.stringMaker.add('\b'); break; diff --git a/src/main/java/com/realtimetech/kson/test/MainTest.java b/src/main/java/com/realtimetech/kson/test/MainTest.java index 26b088f..4c3c567 100644 --- a/src/main/java/com/realtimetech/kson/test/MainTest.java +++ b/src/main/java/com/realtimetech/kson/test/MainTest.java @@ -124,10 +124,5 @@ public void run() { System.out.println("Kson : " + ((endTime - startTime)) + "ms"); } - - while (true) { - Thread.sleep(100000); - } - } } diff --git a/src/main/java/com/realtimetech/kson/test/TestObject.java b/src/main/java/com/realtimetech/kson/test/TestObject.java index 92578ed..f51bb1c 100644 --- a/src/main/java/com/realtimetech/kson/test/TestObject.java +++ b/src/main/java/com/realtimetech/kson/test/TestObject.java @@ -23,6 +23,8 @@ public class TestObject { @Ignore private byte[] bytes; + private String unicodeString; + private Test[] testArray; private int[] intArray; @@ -197,6 +199,7 @@ public TestObject(Test test) { this.emptyArray = new String[0]; this.stringArray = new String[] { "A", "B", "C" }; this.string = "ABC"; + this.unicodeString = "\u0000\u0001\u0302\u0777\u0000"; this.testInterfaceImpl = new TestInterfaceImpl(); this.testAbstractImpl = new TestAbstractImpl();