- } else { // FIELD: new field *or* direct simple value
- if (line.endsWith(":")) {
- // field value is compound
- currentFieldName = line.substring(0, line.length() - 1);
- } else if (line.startsWith(":") || !line.contains(":")
- || line.startsWith("\"") || CustomSerializer.isCustom(line)) {
- // not a field value but a direct value
- me = SerialUtils.decode(line);
- } else {
- // field value is direct
- int pos = line.indexOf(":");
- String fieldName = line.substring(0, pos);
- String encodedValue = line.substring(pos + 1);
- Object value = null;
- value = SerialUtils.decode(encodedValue);
-
- // To support simple types directly:
- if (me == null) {
- me = value;
+
+ return false;
+ }
+
+ if (SerialUtils.isDirectValue(in)) {
+ // not a field value but a direct value
+ me = SerialUtils.decode(in);
+ return false;
+ }
+
+ if (in.startsWith("^")) {
+ in.skip(1);
+
+ NextableInputStream nameThenContent = new NextableInputStream(in,
+ new NextableInputStreamStep(':'));
+
+ try {
+ nameThenContent.next();
+ String fieldName = IOUtils.readSmallStream(nameThenContent);
+
+ if (nameThenContent.nextAll() && !nameThenContent.eof()) {
+ // field value is direct or custom
+ Object value = null;
+ value = SerialUtils.decode(nameThenContent);
+
+ // To support simple types directly:
+ if (me == null) {
+ me = value;
+ } else {
+ setField(fieldName, value);
+ }