Skip to content

Commit d475cb4

Browse files
committed
Provide fast skip method implementation
1 parent 47466e7 commit d475cb4

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/java/com/github/shyiko/mysql/binlog/event/deserialization/json/JsonBinary.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ protected void parseObject(boolean small, JsonFormatter formatter)
403403
} else {
404404
// Parse the value ...
405405
this.reader.reset();
406-
this.reader.skip(objectOffset + entry.index);
406+
this.reader.fastSkip(objectOffset + entry.index);
407407
parse(entry.type, formatter);
408408
}
409409
}
@@ -537,7 +537,7 @@ protected void parseArray(boolean small, JsonFormatter formatter)
537537
} else {
538538
// Parse the value ...
539539
this.reader.reset();
540-
this.reader.skip(arrayOffset + entry.index);
540+
this.reader.fastSkip(arrayOffset + entry.index);
541541

542542
parse(entry.type, formatter);
543543
}

src/main/java/com/github/shyiko/mysql/binlog/io/ByteArrayInputStream.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,4 +241,9 @@ public synchronized void reset() throws IOException {
241241
pos = markPosition;
242242
inputStream.reset();
243243
}
244+
245+
public synchronized long fastSkip(long n) throws IOException {
246+
pos += (int) n;
247+
return inputStream.skip(n);
248+
}
244249
}

0 commit comments

Comments
 (0)