summaryrefslogtreecommitdiff
path: root/java/src/json/ext/Parser.rl
diff options
context:
space:
mode:
Diffstat (limited to 'java/src/json/ext/Parser.rl')
-rw-r--r--java/src/json/ext/Parser.rl11
1 files changed, 7 insertions, 4 deletions
diff --git a/java/src/json/ext/Parser.rl b/java/src/json/ext/Parser.rl
index 1c0222c..6d9d4f9 100644
--- a/java/src/json/ext/Parser.rl
+++ b/java/src/json/ext/Parser.rl
@@ -303,6 +303,7 @@ public class Parser extends RubyObject {
private final Parser parser;
private final ThreadContext context;
private final ByteList byteList;
+ private final ByteList view;
private final byte[] data;
private final StringDecoder decoder;
private int currentNesting = 0;
@@ -317,6 +318,7 @@ public class Parser extends RubyObject {
this.context = context;
this.byteList = parser.checkAndGetSource().getByteList();
this.data = byteList.unsafeBytes();
+ this.view = new ByteList(data, false);
this.decoder = new StringDecoder(context);
this.dc = new DoubleConverter();
}
@@ -794,6 +796,7 @@ public class Parser extends RubyObject {
%% write exec;
if (cs < JSON_object_first_final) {
+ res.update(null, p + 1);
return;
}
@@ -926,14 +929,14 @@ public class Parser extends RubyObject {
}
/**
- * Returns a subsequence of the source ByteList, based on source
- * array byte offsets (i.e., the ByteList's own begin offset is not
- * automatically added).
+ * Updates the "view" bytelist with the new offsets and returns it.
* @param start
* @param end
*/
private ByteList absSubSequence(int absStart, int absEnd) {
- return new ByteList(byteList.unsafeBytes(), absStart, absEnd - absStart, false);
+ view.setBegin(absStart);
+ view.setRealSize(absEnd - absStart);
+ return view;
}
/**