Commits

John Marsden committed 504664e

Test Version

Comments (0)

Files changed (22)

src/main/java/cc/plural/jsonij/ConstantUtility.java

 import static cc.plural.jsonij.Constants.PLUS;
 import static cc.plural.jsonij.Constants.SPACE;
 import static cc.plural.jsonij.Constants.TAB;
+import static cc.plural.jsonij.Constants.SOLIDUS_CHAR;
 
 
 public class ConstantUtility {
         return //( r >= 93 && r <= 1114111 ) || ( r >= 35 && r <= 91 ) || ( r == 32 ) || ( r == 33 );
                 r >= 32 && r != 34 && r != 92;
     }
+
+    static boolean isComment(int r) {
+        return r == SOLIDUS_CHAR;
+    }
 }

src/main/java/cc/plural/jsonij/FastJSONParser.java

     private StringBuilder numericStringBuilder;
     
     public final Value parse(java.lang.String targetString) throws IOException, ParserException {
-        if (targetString == null) {
-            throw new NullPointerException();
-        }
-        if (targetString.trim().equals("")) {
-            throw new JSONParserException("invalidEmpty");
-        }
         target = new StringJSONReader(targetString);
         int r = target.peek();
         if (r == -1) {
         } else if (r == OPEN_ARRAY) {
             value = parseArray();
         } else {
-            //throw new JSONParserException("invalidExpecting2", (char) OPEN_OBJECT, (char) OPEN_ARRAY, (char) r);
-            value = parseValue();
+             value = parseValue();
         }
         if (target.peek() != -1) {
             //throw new JSONParserException("invalidExtraJunk", (char) OPEN_OBJECT, (char) OPEN_ARRAY);
     }
     
     public final Value parse(Reader targetReader) throws IOException, ParserException {
-        if (targetReader == null) {
-            throw new NullPointerException();
-        }
         target = new ReaderJSONReader(targetReader);
         int r = target.peek();
         if (r == -1) {

src/main/java/cc/plural/jsonij/JPath.java

 /**
  * Copyright (C) 2010-2011 J.W.Marsden
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
 package cc.plural.jsonij;
 
 import java.io.IOException;
 import cc.plural.jsonij.parser.ParserException;
 
 /**
- * JPath implementation. Inspired by XPath and <a href="http://goessner.net/articles/JsonPath/">JsonPath</a>.
+ * JPath implementation. Inspired by XPath and <a
+ * href="http://goessner.net/articles/JsonPath/">JsonPath</a>.
  *
  * @author J.W.Marsden
  */
 public class JPath<C extends Component> extends JPathImp<C> {
 
     /**
-	 * Serial UID
-	 */
-	private static final long serialVersionUID = -1908871021763306556L;
+     * Serial UID
+     */
+    private static final long serialVersionUID = -1908871021763306556L;
 
-	public JPath() {
+    public static final JPathParser parser;
+    
+    static {
+        parser = new JPathParser();
+    }
+    
+    public JPath() {
     }
 
     public static JPath<Component> parse(String path) throws IOException, ParserException {
-        JPathParser parser = new JPathParser();
         JPath<Component> jPath = parser.parse(path);
         return jPath;
     }
 
     public static Value evaluate(java.lang.String document, java.lang.String jPath) throws ParserException, IOException {
         JSON jsonDocument = JSON.parse(document);
-        JPath<?> jPathInstance = JPath.parse(jPath);
+        JPath<?> jPathInstance = parser.parse(jPath);
         return jPathInstance.evaluate(jsonDocument);
     }
 
     public static Value evaluate(Reader documentReader, java.lang.String jPath) throws ParserException, IOException {
         JSON jsonDocument = JSON.parse(documentReader);
-        JPath<?> jPathInstance = JPath.parse(jPath);
+        JPath<?> jPathInstance = parser.parse(jPath);
         return jPathInstance.evaluate(jsonDocument);
     }
 
     public static Value evaluate(JSON jsonDocument, java.lang.String jPath) throws ParserException, IOException {
-        JPath<?> jPathInstance = JPath.parse(jPath);
+        JPath<?> jPathInstance = parser.parse(jPath);
         return jPathInstance.evaluate(jsonDocument);
     }
 
     public static Value evaluate(Value value, java.lang.String jPath) throws ParserException, IOException {
-        JPath<?> jPathInstance = JPath.parse(jPath);
+        JPath<?> jPathInstance = parser.parse(jPath);
         return jPathInstance.evaluate(value);
     }
 }

src/main/java/cc/plural/jsonij/JSON.java

  * @author J.W.Marsden
  * @version 1.0.0
  */
-public class JSON {
+public final class JSON {
 
     /**
      * Root Value for the JSON Document.
      * constructing new JSON.Null instances.
      */
     public static final Null NULL;
-    public static final JSONParser parser;
+    public static final JSONParser PARSER;
 
     static {
         TRUE = new JSON.True();
         FALSE = new JSON.False();
         NULL = new JSON.Null();
-        parser = new FastJSONParser();
+        PARSER = new FastJSONParser();
     }
 
     /**
 
     @Override
     public java.lang.String toString() {
-        return java.lang.String.format("JSON@%s:%s", Integer.toHexString(hashCode()), getRoot().toString());
+        return "JSON@" + Integer.toHexString(hashCode()) + ":" + getRoot().toString();
     }
 
     @Override
      * @throws IOException IO Exception.
      */
     public static JSON parse(java.lang.String document) throws ParserException, IOException {
-        return new JSON(parser.parse(document));
+        return new JSON(PARSER.parse(document));
     }
 
     public static JSON parse(InputStream documentStream) throws ParserException, IOException {
-        return new JSON(parser.parse(new InputStreamReader(documentStream)));
+        return new JSON(PARSER.parse(new InputStreamReader(documentStream)));
     }
 
     /**
      * @throws IOException IO Exception.
      */
     public static JSON parse(Reader documentReader) throws ParserException, IOException {
-        return new JSON(parser.parse(documentReader));
+        return new JSON(PARSER.parse(documentReader));
     }
 
     public static Value parseValue(java.lang.String document) throws ParserException, IOException {
-        return parser.parse(document);
+        return PARSER.parse(document);
     }
 
     /**
      * @param <K> The key internalType (must extend JSON.String).
      * @param <V> The element (must extend Value).
      */
-    public static class Object<K extends CharSequence, V extends Value> extends ObjectImp<K, V> {
+    public static final class Object<K extends CharSequence, V extends Value> extends ObjectImp<K, V> {
 
         /**
          * Serial UID
      *
      * @param <E> The element that the Array will hold (must extend Value).
      */
-    public static class Array<E extends Value> extends ArrayImp<E> {
+    public static final class Array<E extends Value> extends ArrayImp<E> {
 
         /**
          * Serial UID
     /**
      * JSON Numeric. Wrapper for NumericImp.
      */
-    public static class Numeric extends NumericImp {
+    public static final class Numeric extends NumericImp {
 
         /**
          * Serial UID
     /**
      * JSON String. Wrapper for StringImp.
      */
-    public static class String extends StringImp {
+    public static final class String extends StringImp {
 
         /**
          * Serial UID
     /**
      * JSON True Implementation.
      */
-    public static class True extends Boolean {
+    public static final class True extends Boolean {
 
         /**
          * Serial UID
     /**
      * JSON False Implementation.
      */
-    public static class False extends Boolean {
+    public static final class False extends Boolean {
 
         /**
          * Serial UID
     /**
      * JSON Null Implementation.
      */
-    public static class Null extends Value {
+    public static final class Null extends Value {
 
         /**
          * Serial UID

src/main/java/cc/plural/jsonij/ReaderJSONReader.java

 /**
  * Copyright (C) 2010-2011 J.W.Marsden
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
 package cc.plural.jsonij;
 
+import cc.plural.jsonij.parser.ParserException;
 import java.io.IOException;
 import java.io.Reader;
 
 import cc.plural.jsonij.parser.Position;
 import cc.plural.jsonij.parser.ReaderParser;
+import java.util.logging.Level;
+import java.util.logging.Logger;
 
 /**
- * java.io.Reader implementation of a JSONReader. 
+ * java.io.Reader implementation of a JSONReader.
+ *
  * @author J.W.Marsden
  */
 public class ReaderJSONReader extends JSONReader {
      * Reads from the reader.
      *
      * @param targetReader The reader to be read from.
-     * @return The read byte if found otherwise -1 if the end of the stream is reached.
+     * @return The read byte if found otherwise -1 if the end of the stream is
+     * reached.
      * @throws IOException Java IO Exception.
      */
     @Override
-    public int readNext() throws IOException {
-        int r = -1;
-        while (reader.ready() && ( r = reader.read() ) != -1) {
-            getPosition().movePosition();
-            do {
-                if (ConstantUtility.isReturn(r)) {
-                    handleNewLine();
-                    r = reader.read();
-                    if (r != -1 && ConstantUtility.isNewLine(r)) {
-                        continue;
-                    }
-                } else if (ConstantUtility.isNewLine(r)) {
-                    handleNewLine();
-                    r = reader.read();
-                    if (r != -1 && ConstantUtility.isReturn(r)) {
-                        continue;
+    public int readNext() throws ParserException {
+        try {
+            int r = -1;
+            while (reader.ready() && (r = reader.read()) != -1) {
+                position.movePosition();
+//                if (ConstantUtility.isComment(r)) {
+//                    if (reader.ready() && (r = reader.read()) != -1 && ConstantUtility.isComment(r)) {
+//                        do {
+//                            r = reader.read();
+//                            position.movePosition();
+//                        } while (!ConstantUtility.isReturn(r) && !ConstantUtility.isNewLine(r));
+//                    }
+//                }
+                do {
+                    if (ConstantUtility.isReturn(r)) {
+                        handleNewLine();
+                        r = reader.read();
+                        if (r != -1 && ConstantUtility.isNewLine(r)) {
+                            continue;
+                        }
+                    } else if (ConstantUtility.isNewLine(r)) {
+                        handleNewLine();
+                        r = reader.read();
+                        if (r != -1 && ConstantUtility.isReturn(r)) {
+                            continue;
+                        }
                     }
+                } while (ConstantUtility.isReturn(r) || ConstantUtility.isNewLine(r));
+
+                if (!ConstantUtility.isWhiteSpace(r)) {
+                    break;
                 }
-            } while (ConstantUtility.isReturn(r) || ConstantUtility.isNewLine(r));
-            if (!ConstantUtility.isWhiteSpace(r)) {
-                break;
             }
+            return r;
+        } catch (IOException ex) {
+            throw new JSONParserException("readNext", getLineNumber(), getPositionNumber(), ex);
         }
-        return r;
     }
 
     public ReaderParser getStringReader() {
             this.active = active;
         }
 
-        public int peek() throws IOException {
+        public int peek() throws ParserException {
             if (!hasPeeked) {
                 if (!active) {
                     return -1;
             return peekValue;
         }
 
-        public int read() throws IOException {
+        public int read() throws ParserException {
             if (hasPeeked) {
                 if (!active) {
                     return -1;
             active = false;
         }
 
-        protected int readNext() throws IOException {
+        protected int readNext() throws ParserException {
             int r = -1;
-            if (reader.ready() && ( r = reader.read() ) != -1) {
-                position.movePosition();
+            try {
+                if (reader.ready() && (r = reader.read()) != -1) {
+                    position.movePosition();
+                }
+            } catch (IOException ex) {
+                throw new JSONParserException("readNext", getLineNumber(), getPositionNumber(), ex);
             }
             return r;
         }

src/main/java/cc/plural/jsonij/StringJSONReader.java

 /**
  * Copyright (C) 2010-2011 J.W.Marsden
  *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
  *
- *      http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ *
+ */
 package cc.plural.jsonij;
 
-import java.io.IOException;
-
 import cc.plural.jsonij.parser.ParserException;
 import cc.plural.jsonij.parser.Position;
 import cc.plural.jsonij.parser.ReaderParser;
 
 /**
- * java.lang.String implementation of a JSONReader. 
+ * java.lang.String implementation of a JSONReader.
+ *
  * @author J.W.Marsden
  */
 public class StringJSONReader extends JSONReader {
         stringReader = new StringJSONStringReader();
         index = 0;
     }
-    
+
     public StringJSONReader(String jsonString, int index) {
         if (jsonString == null) {
             throw new NullPointerException("Null String Exception.");
     }
 
     @Override
-    public int readNext() throws IOException, ParserException {
+    public int readNext() throws ParserException {
         int r = -1;
         while (index < length) {
             r = jsonString.charAt(index++);
             position.movePosition();
+            
+//            if (ConstantUtility.isComment(r)) {
+//                if (index < length) {
+//                    char peekR = jsonString.charAt(index++);
+//                    if (ConstantUtility.isComment(peekR)) {
+//                        do {
+//                            r = jsonString.charAt(index++);
+//                            position.movePosition();
+//                        } while (!ConstantUtility.isReturn(r) && !ConstantUtility.isNewLine(r));
+//                    }
+//                }
+//            }
+
             do {
                 if (ConstantUtility.isReturn(r)) {
                     handleNewLine();
                         r = jsonString.charAt(index++);
                         if (ConstantUtility.isNewLine(r)) {
                             continue;
-                        } 
+                        }
                     } else {
                         break;
                     }
                         r = jsonString.charAt(index++);
                         if (ConstantUtility.isReturn(r)) {
                             continue;
-                        } 
+                        }
                     } else {
                         break;
                     }
                 }
             } while (ConstantUtility.isReturn(r) || ConstantUtility.isNewLine(r));
+
+
+            
             if (!ConstantUtility.isWhiteSpace(r)) {
                 break;
             }
     public ReaderParser getStringReader() {
         stringReader.setActive(true);
         return stringReader;
+
+
+
+
     }
 
     protected class StringJSONStringReader implements ReaderParser {
             this.active = active;
         }
 
-        public int peek() throws IOException {
+        public int peek() throws ParserException {
             if (!hasPeeked) {
                 if (!active) {
                     return -1;
             return peekValue;
         }
 
-        public int read() throws IOException {
+        public int read() throws ParserException {
             if (!active) {
                 return -1;
             }
             active = false;
         }
 
-        protected int readNext() throws IOException {
-            int r = -1;
+        protected int readNext() throws ParserException {
+            int r;
             if (index < length) {
                 r = jsonString.charAt(index++);
                 position.movePosition();
+            } else {
+                r = -1;
             }
             return r;
         }

src/main/java/cc/plural/jsonij/ThreadSafeJSONParser.java

         return value;
     }
 
-    public final Value parseValue(java.lang.String targetString) throws IOException, ParserException {
+    public final Value parseValue(java.lang.String targetString) throws ParserException {
         if (targetString == null) {
             throw new NullPointerException();
         }
         return parseValue(target);
     }
     
-    public final StatefullValue parseStatefullValue(java.lang.String targetString, int startIndex) throws IOException, ParserException {
+    public final StatefullValue parseStatefullValue(java.lang.String targetString, int startIndex) throws ParserException {
         if (targetString == null) {
             throw new NullPointerException();
         }
      * @throws IOException IO Exception
      * @throws ParserException JSON Parser Exception
      */
-    public final Value parseValue(JSONReader target) throws IOException, ParserException {
+    public final Value parseValue(JSONReader target) throws ParserException {
         Value value = null;
         int p = target.peek();
         if (p == DOUBLE_QUOTE) {
      * @throws IOException IO Exception
      * @throws ParserException JSON Parser Exception
      */
-    public final JSON.Object<JSON.String, Value> parseObject(JSONReader target) throws IOException, ParserException {
+    public final JSON.Object<JSON.String, Value> parseObject(JSONReader target) throws ParserException {
         if (target.peek() != OPEN_OBJECT) {
             throw new JSONParserException("invalidObjectExpecting1", target.getLineNumber(), target.getPositionNumber(), (char) OPEN_OBJECT, (char) target.peek());
         }
      * @throws IOException IO Exception
      * @throws ParserException JSON Parser Exception
      */
-    public final JSON.Array<Value> parseArray(JSONReader target) throws IOException, ParserException {
+    public final JSON.Array<Value> parseArray(JSONReader target) throws ParserException {
         if (target.peek() != OPEN_ARRAY) {
             throw new JSONParserException("invalidArrayExpecting1", target.getLineNumber(), target.getPositionNumber(), (char) OPEN_ARRAY, (char) target.peek());
         }
      * @throws IOException IO Exception
      * @throws ParserException JSON Parser Exception
      */
-    public final JSON.String parseString(JSONReader target) throws IOException, ParserException {
+    public final JSON.String parseString(JSONReader target) throws ParserException {
         JSON.String value = null;
         if (target.peek() != DOUBLE_QUOTE) {
             throw new JSONParserException("invalidStringExpecting1", target.getLineNumber(), target.getPositionNumber(), (char) DOUBLE_QUOTE, (char) target.peek());
      * @throws IOException IO Exception
      * @throws ParserException JSON Parser Exception
      */
-    public final JSON.Numeric parseNumeric(JSONReader target) throws IOException, ParserException {
+    public final JSON.Numeric parseNumeric(JSONReader target) throws ParserException {
         JSON.Numeric value = null;
         StringBuilder numericStringBuilder = new StringBuilder();
         @SuppressWarnings("unused")
      * @throws IOException IO Exception
      * @throws ParserException JSON Parser Exception
      */
-    public final JSON.True parseTrue(JSONReader target) throws IOException, ParserException {
+    public final JSON.True parseTrue(JSONReader target) throws ParserException {
         JSON.True value = null;
         for (int i = 0; i < TRUE_STR.length(); i++) {
             if (target.peek() == TRUE_STR.charAt(i)) {
      * @throws IOException IO Exception
      * @throws ParserException JSON Parser Exception
      */
-    public final JSON.False parseFalse(JSONReader target) throws IOException, ParserException {
+    public final JSON.False parseFalse(JSONReader target) throws ParserException {
         JSON.False value = null;
         for (int i = 0; i < FALSE_STR.length(); i++) {
             if (target.peek() == FALSE_STR.charAt(i)) {
      * @throws IOException IO Exception
      * @throws ParserException JSON Parser Exception
      */
-    public final JSON.Null parseNull(JSONReader target) throws IOException, ParserException {
+    public final JSON.Null parseNull(JSONReader target) throws ParserException {
         JSON.Null value = null;
         for (int i = 0; i < NULL_STR.length(); i++) {
             if (target.peek() == NULL_STR.charAt(i)) {

src/main/java/cc/plural/jsonij/Value.java

     public int getInt() {
         int result = -1;
         switch (valueType) {
+            case NUMERIC:
+                result = ((JSON.Numeric) this).intValue();
+                break;
             case TRUE:
                 result = 1;
                 break;
             case FALSE:
                 result = 0;
                 break;
-            case NUMERIC:
-                result = ((JSON.Numeric) this).intValue();
-                break;
             case STRING:
                 result = Integer.parseInt((this).toString());
                 break;
     public double getDouble() {
         double result = -1D;
         switch (valueType) {
+            case NUMERIC:
+                result = ((JSON.Numeric) this).doubleValue();
+                break;
             case TRUE:
                 result = 1D;
                 break;
             case FALSE:
                 result = 0D;
                 break;
+            case STRING:
+                result = Double.parseDouble((this).toString());
+                break;
+        }
+        return result;
+    }
+    
+    /**
+     * Finds the long representation for the Value. Returns 1L when the value
+     * is JSON True and 0L when the value is JSON False. When the value is
+     * Numeric it will return the doubleValue from Number. If the value is a
+     * String then an attempt is made to parse the String value into an Long
+     * and return it. All other types return -1L.
+     *
+     * @return long The long value for the Value.
+     */
+    public long getLong() {
+        long result = -1L;
+        switch (valueType) {
             case NUMERIC:
-                result = ((JSON.Numeric) this).doubleValue();
+                result = ((JSON.Numeric) this).longValue();
+                break;
+            case TRUE:
+                result = 1L;
+                break;
+            case FALSE:
+                result = 0L;
                 break;
             case STRING:
-                result = Double.parseDouble((this).toString());
+                result = Long.parseLong((this).toString());
                 break;
         }
         return result;
     public Number getNumber() {
         Number result = -1D;
         switch (valueType) {
+            case NUMERIC:
+                result = ((JSON.Numeric) this).getNumber();
+                break;
             case TRUE:
                 result = 1D;
                 break;
             case FALSE:
                 result = 0D;
                 break;
-            case NUMERIC:
-                result = ((JSON.Numeric) this).getNumber();
-                break;
             case STRING:
                 result = Double.parseDouble((this).toString());
                 break;
     public String getString() {
         String result = null;
         switch (valueType) {
+            case STRING:
+                result = (this).toString();
+                break;
             case TRUE:
                 result = "true";
                 break;
             case NUMERIC:
                 result = ((JSON.Numeric) this).toString();
                 break;
-            case STRING:
-                result = (this).toString();
-                break;
         }
         return result;
     }

src/main/java/cc/plural/jsonij/jpath/JPathParser.java

  */
 public class JPathParser {
 
-    public JPath<Component> parse(String jPath) throws IOException, ParserException {
+    public JPath<Component> parse(String jPath) throws ParserException {
         JPathReader target = new JPathReader(jPath);
         return parse(target);
     }
 
-    public JPath<Component> parse(JPathReader target) throws IOException, ParserException {
+    public JPath<Component> parse(JPathReader target) throws ParserException {
         
         JPath<Component> path = new JPath<Component>();
         while (target.peek() != -1) {
         return path;
     }
 
-    public KeyComponent readKey(JPathReader target) throws IOException, ParserException {
+    public KeyComponent readKey(JPathReader target) throws ParserException {
         StringBuilder keyBuilder = new StringBuilder();
         while (true) {
             if (target.peek() == -1) {
         return new KeyComponent(keyBuilder.toString());
     }
 
-    public PredicateComponent readPredicate(JPathReader target) throws IOException, ParserException {
+    public PredicateComponent readPredicate(JPathReader target) throws ParserException {
         if (target.peek() == -1) {
             return null;
         }
         }
 
         @Override
-        public int readNext() throws IOException, ParserException {
+        public int readNext() throws ParserException {
             if(index < jPathString.length()) {
                 return jPathString.charAt(index++);
             } else {
             }
         }
 
-        public void skipWhitepace(StringBuilder appender) throws IOException, ParserException {
+        public void skipWhitepace(StringBuilder appender) throws ParserException {
             while(ConstantUtility.isWhiteSpace(peek())) {
                 appender.append((char) read());
             }

src/main/java/cc/plural/jsonij/jpath/functions/FunctionArgument.java

         }
     }
     
-    public static FunctionArgument[] parseStringToArguments(String string) throws IOException, JPathParserException {
+    public static FunctionArgument[] parseStringToArguments(String string) throws JPathParserException {
         FunctionArgument[] argumentArray = null;
         List<FunctionArgument> argumentList = new ArrayList<FunctionArgument>();
         int stringLength = string.length();

src/main/java/cc/plural/jsonij/marshal/JavaMarshalerObjects.java

     public Value marshalJavaObject(Object o, CycleDetector cycleDetector) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, JSONMarshalerException {
         Class<?> objectClass = o.getClass();
         // Check for JSONEncoder Annotation
-        Method[] methods = objectClass.getDeclaredMethods();
-        for (Method method : methods) {
-            if (method.getAnnotation(JSONEncoder.class) != null) {
-                // TODO: Encode using method.
-            }
-        }
-
-        Field[] fields = objectClass.getFields();
-        for (Field field : fields) {
-            if (field.getAnnotation(JSONCollector.class) != null) {
-            }
-        }
+//        Method[] methods = objectClass.getDeclaredMethods();
+//        for (Method method : methods) {
+//            if (method.getAnnotation(JSONEncoder.class) != null) {
+//                // TODO: Encode using method.
+//            }
+//        }
+//
+//        Field[] fields = objectClass.getFields();
+//        for (Field field : fields) {
+//            if (field.getAnnotation(JSONCollector.class) != null) {
+//            }
+//        }
 
 
 

src/main/java/cc/plural/jsonij/parser/BaseReaderParser.java

 import java.io.IOException;
 import java.io.Reader;
 
-import cc.plural.jsonij.parser.BaseParserException;
-import cc.plural.jsonij.parser.ParserException;
-import cc.plural.jsonij.parser.Position;
-import cc.plural.jsonij.parser.ReaderParser;
 
 /**
  *
         return getPosition().getPostionNumber();
     }
 
-    public int peek() throws IOException, ParserException {
+    public int peek() throws ParserException {
         if (!hasPeeked) {
             peekValue = readNext();
             hasPeeked = true;
         return peekValue;
     }
 
-    public int read() throws IOException, ParserException {
+    public int read() throws ParserException {
         if (hasPeeked) {
             hasPeeked = false;
             return peekValue;
      *
      * @param targetReader The reader to be read from.
      * @return The read byte if found otherwise -1 if the end of the stream is reached.
-     * @throws IOException Java IO Exception.
      */
-    protected abstract int readNext() throws IOException, ParserException;
+    protected abstract int readNext() throws ParserException;
 
     public void close() {
 
     }
 
 
-    protected void handleNewLine() throws IOException {
+    protected void handleNewLine() throws ParserException {
         getPosition().newLine();
     }
 
         String state = "";
         try {
             state = String.format("Next Char %s", (char) peek());
-        } catch (IOException e) {
-            state = String.format("Unknown State: %s", e.toString());
         } catch (BaseParserException e) {
             state = String.format("Unknown State: %s", e.toString());
         }

src/main/java/cc/plural/jsonij/parser/ReaderParser.java

 
     public int getPositionNumber();
 
-    public int peek() throws IOException, ParserException;
+    public int peek() throws ParserException;
 
-    public int read() throws IOException, ParserException;
+    public int read() throws ParserException;
 
     public void close();
 }

src/main/java/cc/plural/jsonij/select/SelectParser.java

         }
 
         @Override
-        public int readNext() throws IOException, ParserException {
+        public int readNext() throws ParserException {
             if (index < selectString.length()) {
                 return selectString.charAt(index++);
             } else {

src/test/java/cc/plural/jvmserializers/Image.java

+package cc.plural.jvmserializers;
+
+public class Image implements java.io.Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    public enum Size {
+		SMALL, LARGE
+	}
+
+	public String uri;
+
+	public String title;  // Can be null
+	public int width;
+	public int height;
+	public Size size;
+
+	public Image() {}
+
+	public Image (String uri, String title, int width, int height, Size size) {
+		this.height = height;
+		this.title = title;
+		this.uri = uri;
+		this.width = width;
+		this.size = size;
+	}
+
+	@Override
+	public boolean equals(Object o)
+	{
+		if (this == o) return true;
+		if (o == null || getClass() != o.getClass()) return false;
+
+		Image image = (Image) o;
+
+		if (height != image.height) return false;
+		if (width != image.width) return false;
+		if (size != image.size) return false;
+		if (title != null ? !title.equals(image.title) : image.title != null) return false;
+		if (uri != null ? !uri.equals(image.uri) : image.uri != null) return false;
+
+		return true;
+	}
+
+	@Override
+	public int hashCode()
+	{
+		int result = uri != null ? uri.hashCode() : 0;
+		result = 31 * result + (title != null ? title.hashCode() : 0);
+		result = 31 * result + width;
+		result = 31 * result + height;
+		result = 31 * result + (size != null ? size.hashCode() : 0);
+		return result;
+	}
+
+	public String toString () {
+		StringBuilder sb = new StringBuilder();
+		sb.append("[Image ");
+		sb.append("uri=").append(Media.repr(uri));
+		sb.append(", title=").append(Media.repr(title));
+		sb.append(", width=").append(width);
+		sb.append(", height=").append(height);
+		sb.append(", size=").append(size);
+		sb.append("]");
+		return sb.toString();
+	}
+
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public void setWidth(int width) {
+        this.width = width;
+    }
+
+    public void setHeight(int height) {
+        this.height = height;
+    }
+
+    public void setSize(Size size) {
+        this.size = size;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public int getWidth() {
+        return width;
+    }
+
+    public int getHeight() {
+        return height;
+    }
+
+    public Size getSize() {
+        return size;
+    }
+}

src/test/java/cc/plural/jvmserializers/Media.java

+package cc.plural.jvmserializers;
+
+import java.util.List;
+
+@SuppressWarnings("serial")
+public class Media implements java.io.Serializable {
+	public enum Player {
+		JAVA, FLASH;
+		
+		public static Player find(String str) {
+		    if (str == "JAVA") return JAVA;
+		    if (str == "FLASH") return FLASH;
+		    if ("JAVA".equals(str)) return JAVA;
+		    if ("FLASH".equals(str)) return FLASH;
+		    String desc = (str == null) ? "NULL" : String.format("'%s'", str);
+		    throw new IllegalArgumentException("No Player value of "+desc);
+		}
+	}
+
+	public String uri;
+	public String title;        // Can be unset.
+	public int width;
+	public int height;
+	public String format;
+	public long duration;
+	public long size;
+	public int bitrate;         // Can be unset.
+
+	@cc.plural.jsonij.marshal.annotation.JSONIgnore // required by JSONiJ
+	public boolean hasBitrate;
+
+	public List<String> persons;
+	
+	public Player player;
+
+	public String copyright;    // Can be unset.
+
+	public Media() {}
+
+	public Media(String uri, String title, int width, int height, String format, long duration, long size, int bitrate, boolean hasBitrate, List<String> persons, Player player, String copyright)
+	{
+		this.uri = uri;
+		this.title = title;
+		this.width = width;
+		this.height = height;
+		this.format = format;
+		this.duration = duration;
+		this.size = size;
+		this.bitrate = bitrate;
+		this.hasBitrate = hasBitrate;
+		this.persons = persons;
+		this.player = player;
+		this.copyright = copyright;
+	}
+
+	@Override
+	public boolean equals(Object o)
+	{
+		if (this == o) return true;
+		if (o == null || getClass() != o.getClass()) return false;
+
+		Media media = (Media) o;
+
+		if (bitrate != media.bitrate) return false;
+		if (duration != media.duration) return false;
+		if (hasBitrate != media.hasBitrate) return false;
+		if (height != media.height) return false;
+		if (size != media.size) return false;
+		if (width != media.width) return false;
+		if (copyright != null ? !copyright.equals(media.copyright) : media.copyright != null) return false;
+		if (format != null ? !format.equals(media.format) : media.format != null) return false;
+		if (persons != null ? !persons.equals(media.persons) : media.persons != null) return false;
+		if (player != media.player) return false;
+		if (title != null ? !title.equals(media.title) : media.title != null) return false;
+		if (uri != null ? !uri.equals(media.uri) : media.uri != null) return false;
+
+		return true;
+	}
+
+	@Override
+	public int hashCode()
+	{
+		int result = uri != null ? uri.hashCode() : 0;
+		result = 31 * result + (title != null ? title.hashCode() : 0);
+		result = 31 * result + width;
+		result = 31 * result + height;
+		result = 31 * result + (format != null ? format.hashCode() : 0);
+		result = 31 * result + (int) (duration ^ (duration >>> 32));
+		result = 31 * result + (int) (size ^ (size >>> 32));
+		result = 31 * result + bitrate;
+		result = 31 * result + (hasBitrate ? 1 : 0);
+		result = 31 * result + (persons != null ? persons.hashCode() : 0);
+		result = 31 * result + (player != null ? player.hashCode() : 0);
+		result = 31 * result + (copyright != null ? copyright.hashCode() : 0);
+		return result;
+	}
+
+	public String toString () {
+		StringBuilder sb = new StringBuilder();
+		sb.append("[Media ");
+		sb.append("uri=").append(repr(uri));
+		sb.append(", title=").append(repr(title));
+		sb.append(", width=").append(width);
+		sb.append(", height=").append(height);
+		sb.append(", format=").append(repr(format));
+		sb.append(", duration=").append(duration);
+		sb.append(", size=").append(size);
+		sb.append(", hasBitrate=").append(hasBitrate);
+		sb.append(", bitrate=").append(String.valueOf(bitrate));
+		sb.append(", persons=").append(repr(persons));
+		sb.append(", player=").append(player);
+		sb.append(", copyright=").append(repr(copyright));
+		sb.append("]");
+		return sb.toString();
+	}
+
+    public void setUri(String uri) {
+        this.uri = uri;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public void setWidth(int width) {
+        this.width = width;
+    }
+
+    public void setHeight(int height) {
+        this.height = height;
+    }
+
+    public void setFormat(String format) {
+        this.format = format;
+    }
+
+    public void setDuration(long duration) {
+        this.duration = duration;
+    }
+
+    public void setSize(long size) {
+        this.size = size;
+    }
+
+    public void setBitrate(int bitrate) {
+        this.bitrate = bitrate;
+        this.hasBitrate = true;
+    }
+
+    public void setPersons(List<String> persons) {
+        this.persons = persons;
+    }
+
+    public void setPlayer(Player player) {
+        this.player = player;
+    }
+
+    public void setCopyright(String copyright) {
+        this.copyright = copyright;
+    }
+
+    public String getUri() {
+        return uri;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public int getWidth() {
+        return width;
+    }
+
+    public int getHeight() {
+        return height;
+    }
+
+    public String getFormat() {
+        return format;
+    }
+
+    public long getDuration() {
+        return duration;
+    }
+
+    public long getSize() {
+        return size;
+    }
+
+    public int getBitrate() {
+        return bitrate;
+    }
+
+    public List<String> getPersons() {
+        return persons;
+    }
+
+    public Player getPlayer() {
+        return player;
+    }
+
+    public String getCopyright() {
+        return copyright;
+    }
+    
+    public static String repr(String s)
+	{
+		if (s == null) return "null";
+		return '"' + s + '"';
+	}
+
+	public static String repr(Iterable<String> it)
+	{
+		StringBuilder buf = new StringBuilder();
+		buf.append('[');
+		String sep = "";
+		for (String s : it) {
+			buf.append(sep); sep = ", ";
+			buf.append(repr(s));
+		}
+		buf.append(']');
+		return buf.toString();
+	}
+}

src/test/java/cc/plural/jvmserializers/MediaContent.java

+package cc.plural.jvmserializers;
+
+import java.util.List;
+
+@SuppressWarnings("serial")
+public class MediaContent implements java.io.Serializable
+{
+	public Media media;
+	public List<Image> images;
+
+	public MediaContent() {}
+
+	public MediaContent (Media media, List<Image> images) {
+		this.media = media;
+		this.images = images;
+	}
+
+	@Override
+	public boolean equals(Object o)
+	{
+		if (this == o) return true;
+		if (o == null || getClass() != o.getClass()) return false;
+
+		MediaContent that = (MediaContent) o;
+
+		if (images != null ? !images.equals(that.images) : that.images != null) return false;
+		if (media != null ? !media.equals(that.media) : that.media != null) return false;
+
+		return true;
+	}
+
+	@Override
+	public int hashCode()
+	{
+		int result = media != null ? media.hashCode() : 0;
+		result = 31 * result + (images != null ? images.hashCode() : 0);
+		return result;
+	}
+
+	public String toString() {
+		StringBuilder sb = new StringBuilder();
+		sb.append("[MediaContent: ");
+		sb.append("media=").append(media);
+		sb.append(", images=").append(images);
+		sb.append("]");
+		return sb.toString();
+	}
+
+    public void setMedia(Media media) {
+        this.media = media;
+    }
+
+    public void setImages(List<Image> images) {
+        this.images = images;
+    }
+
+    public Media getMedia() {
+        return media;
+    }
+
+    public List<Image> getImages() {
+        return images;
+    }
+}

src/test/java/cc/plural/jvmserializers/MediaParseTest.java

+/*
+ * Copyright 2011 jmarsden.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package cc.plural.jvmserializers;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import cc.plural.jsonij.JSON;
+import cc.plural.jsonij.Value;
+import cc.plural.jsonij.marshal.JSONMarshaler;
+import cc.plural.jsonij.parser.ParserException;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MediaParseTest {
+
+    public MediaParseTest() {
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws Exception {
+    }
+
+    @AfterClass
+    public static void tearDownClass() throws Exception {
+    }
+
+    @Before
+    public void setUp() {
+    }
+
+    @After
+    public void tearDown() {
+    }
+
+    @Test
+    public void testMedia1InputStream() throws ParserException, IOException {
+        System.out.println("testMedia1");
+        for (int i = 0; i < 1; i++) {
+
+            URL file = ClassLoader.class.getResource("/jvmtests/media.1.cks");
+
+            JSON resultJSON = JSON.parse(file.openStream());
+
+            String resultString = resultJSON.toString();
+        }
+    }
+
+    @Test
+    public void testMedia1String() throws ParserException, IOException, Exception {
+        System.out.println("testMedia1String");
+
+        StringBuilder result = new StringBuilder();
+
+        try {
+            InputStream inputStream = ClassLoader.class.getResourceAsStream("/jvmtests/media.1.cks");
+
+            BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
+
+            char[] buf = new char[1024];
+
+            int r = 0;
+
+            while ((r = reader.read(buf)) != -1) {
+                result.append(buf, 0, r);
+            }
+            reader.close();
+        } finally {
+        }
+
+        String jsonString = result.toString();
+
+        for (int i = 0; i < 10000; i++) {
+            JSON mediaContentJsonObject = JSON.parse(jsonString);
+
+            JSON.Object mediaJsonObject = (JSON.Object) mediaContentJsonObject.get("media");
+            Media media = readMedia(mediaJsonObject);
+
+            JSON.Array<Value> imageValues = (JSON.Array<Value>) mediaContentJsonObject.get("images");
+            List<Image> images = readImages(imageValues);
+
+            MediaContent mediaContent = new MediaContent();
+            mediaContent.media = media;
+            mediaContent.images = images;
+
+            StringWriter writer = new StringWriter();
+            writeMediaContent(writer, mediaContent);
+            writer.flush();
+            String output = writer.toString();
+        }
+    }
+
+    static MediaContent readMediaContent(String mediaContentJsonInput) throws Exception {
+
+        JSON.Object mediaContentJsonObject = (JSON.Object) JSON.parse(mediaContentJsonInput).getRoot();
+
+        JSON.Object mediaJsonObject = (JSON.Object) mediaContentJsonObject.get("media");
+        Media media = readMedia(mediaJsonObject);
+
+        JSON.Array<Value> imageValues = (JSON.Array<Value>) mediaContentJsonObject.get("images");
+        List<Image> images = readImages(imageValues);
+
+        MediaContent mediaContent = new MediaContent();
+        mediaContent.media = media;
+        mediaContent.images = images;
+        return mediaContent;
+    }
+
+    @SuppressWarnings({"unchecked"})
+    static List<Image> readImages(String imagesJsonInput) throws Exception {
+        JSON.Array<Value> imageValues = (JSON.Array<Value>) JSON.parse(imagesJsonInput).getRoot();
+        return readImages(imageValues);
+    }
+
+    @SuppressWarnings("rawtypes")
+    static List<Image> readImages(JSON.Array<Value> imageValues) throws Exception {
+        int size = imageValues.size();
+        List<Image> images = new ArrayList<Image>(size);
+        for (int i = 0; i < size; i++) {
+            JSON.Object imageJsonObject = (JSON.Object) imageValues.get(i);
+            Image image = readImage(imageJsonObject);
+            images.add(image);
+        }
+        return images;
+    }
+
+    @SuppressWarnings("rawtypes")
+    static Image readImage(String imageJsonInput) throws Exception {
+        JSON.Object imageJsonObject = (JSON.Object) JSON.parse(imageJsonInput).getRoot();
+        return readImage(imageJsonObject);
+    }
+
+    @SuppressWarnings("rawtypes")
+    static Image readImage(JSON.Object imageJsonObject) throws Exception {
+        Image image = new Image();
+        image.height = imageJsonObject.get("height").getInt();
+        image.size = Image.Size.valueOf(imageJsonObject.get("size").getString());
+        image.title = imageJsonObject.get("title").getString();
+        image.uri = imageJsonObject.get("uri").getString();
+        image.width = imageJsonObject.get("width").getInt();
+        return image;
+    }
+
+    @SuppressWarnings({"rawtypes"})
+    static Media readMedia(String mediaJsonInput) throws Exception {
+        JSON.Object mediaJsonObject = (JSON.Object) JSON.parse(mediaJsonInput).getRoot();
+        return readMedia(mediaJsonObject);
+    }
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    static Media readMedia(JSON.Object mediaJsonObject) {
+        Media media = new Media();
+        Value bitrate = mediaJsonObject.get("bitrate");
+        if (bitrate != null && !bitrate.isNull()) {
+            media.bitrate = bitrate.getInt();
+            media.hasBitrate = true;
+        }
+        Value copyright = mediaJsonObject.get("copyright");
+        if (copyright != null && !copyright.isNull()) {
+            media.copyright = copyright.getString();
+        }
+        media.duration = mediaJsonObject.get("duration").getLong();
+        media.format = mediaJsonObject.get("format").getString();
+        media.height = mediaJsonObject.get("height").getInt();
+        JSON.Array<Value> personValues = (JSON.Array<Value>) mediaJsonObject.get("persons");
+        int size = personValues.size();
+        List<String> persons = new ArrayList<String>(size);
+        for (int i = 0; i < size; i++) {
+            persons.add(personValues.get(i).getString());
+        }
+        media.persons = persons;
+        media.player = Media.Player.valueOf(mediaJsonObject.get("player").getString());
+        media.size = mediaJsonObject.get("size").getLong();
+        media.title = mediaJsonObject.get("title").getString();
+        media.uri = mediaJsonObject.get("uri").getString();
+        media.width = mediaJsonObject.get("width").getInt();
+        return media;
+    }
+
+    static void writeMedia(StringWriter writer, Media media) throws Exception {
+        JSON json = JSONMarshaler.marshalObject(media);
+        writer.write(json.toJSON());
+    }
+
+    static void writeImage(StringWriter writer, Image image) throws Exception {
+        JSON json = JSONMarshaler.marshalObject(image);
+        writer.write(json.toJSON());
+    }
+
+    static void writeImages(StringWriter writer, List<Image> images) throws Exception {
+        JSON json = JSONMarshaler.marshalObject(images);
+        writer.write(json.toJSON());
+    }
+
+    static void writeMediaContent(StringWriter writer, MediaContent mediaContent) throws Exception {
+        JSON json = JSONMarshaler.marshalObject(mediaContent);
+        writer.write(json.toJSON());
+    }
+}

src/test/resources/jvmtests/media.1.cks

+{"images":[{"title":"Javaone Keynote","height":768,"width":1024,"uri":"http:\/\/javaone.com\/keynote_large.jpg","size":"LARGE"},{"title":"Javaone Keynote","height":240,"width":320,"uri":"http:\/\/javaone.com\/keynote_small.jpg","size":"SMALL"}],"media":{"title":"Javaone Keynote","duration":18000000,"height":480,"player":"JAVA","width":640,"bitrate":262144,"format":"video\/mpg4","uri":"http:\/\/javaone.com\/keynote.mpg","persons":["Bill Gates","Steve Jobs"],"hasBitrate":true,"size":58982400}}

src/test/resources/jvmtests/media.2.cks

+// A test value where everything is different from media.1.cks.
+// This is mainly used to check if the serializers are "honest".
+{
+	Media = {
+		Uri = "http://javaone.com/keynote.ogg"
+		Title = None
+		Width = 641
+		Height = 481
+		Format = "video/theora"
+		Duration = 18000001
+		Size = 58982401
+		Bitrate = None
+		Persons = ["Bill Gates, Jr.", "Steven Jobs"]
+		Player = Flash
+		Copyright = Set: "2009, Scooby Doo"
+	}
+
+	Images = [
+		{
+			Uri = "http://javaone.com/keynote_huge.jpg"
+			Title = Set: "Javaone Keynote"
+			Width = 32000
+			Height = 24000
+			Size = Large
+		}
+		{
+			Uri = "http://javaone.com/keynote_large.jpg"
+			Title = None
+			Width = 1024
+			Height = 768
+			Size = Large
+		}
+		{
+			Uri = "http://javaone.com/keynote_small.jpg"
+			Title = None
+			Width = 320
+			Height = 240
+			Size = Small
+		}
+	]
+}

src/test/resources/jvmtests/media.3.cks

+// Long strings.
+{
+	Media = {
+		Uri = "http://javaone.com/keynote.mpglkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj"
+		Title = Set: "Javaone Keynotelkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj"
+		Width = 640
+		Height = 480
+		Format = "video/mpg4lkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj"
+		Duration = 18000000    // half hour in milliseconds
+		Size = 58982400        // bitrate * duration in seconds / 8 bits per byte
+		Bitrate = Set: 262144  // 256k
+		Persons = ["Bill Gateslkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj", "Steve Jobslkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj"]
+		Player = Java
+		Copyright = None
+	}
+
+	Images = [
+		{
+			Uri = "http://javaone.com/keynote_large.jpglkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj"
+			Title = Set: "Javaone Keynotelkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj"
+			Width = 1024
+			Height = 768
+			Size = Large
+		}
+		{
+			Uri = "http://javaone.com/keynote_small.jpglkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj"
+			Title = Set: "Javaone Keynotelkajldfjlskajdflkjslfjdslfjldjfljsdfljsdlfjsljfldjfldjals;djfasldjf;alskdjf;aslkdjf;asdjf;laskdjflsjdalfjd;alksjdfl;jsa;lfdja;slkdjf;alsjfd;lajsfl;dj"
+			Width = 320
+			Height = 240
+			Size = Small
+		}
+	]
+}

src/test/resources/jvmtests/media.4.cks

+// Short strings.
+{
+	Media = {
+		Uri = "g"
+		Title = Set: "J"
+		Width = 640
+		Height = 480
+		Format = "v"
+		Duration = 18000000    // half hour in milliseconds
+		Size = 58982400        // bitrate * duration in seconds / 8 bits per byte
+		Bitrate = Set: 262144  // 256k
+		Persons = ["B", "S"]
+		Player = Java
+		Copyright = None
+	}
+
+	Images = [
+		{
+			Uri = "h"
+			Title = Set: "J"
+			Width = 1024
+			Height = 768
+			Size = Large
+		}
+		{
+			Uri = "h"
+			Title = Set: "J"
+			Width = 320
+			Height = 240
+			Size = Small
+		}
+	]
+}