Incorporating the review comments. While more than 1 charachter might be read from the buffer the output will have only one escaped charachter.
This commit is contained in:
parent
2d072bae3a
commit
4644837207
|
@ -1006,13 +1006,12 @@ public class JsonReader implements Closeable {
|
||||||
} else if (c == '\\') {
|
} else if (c == '\\') {
|
||||||
pos = p;
|
pos = p;
|
||||||
int len = p - start - 1;
|
int len = p - start - 1;
|
||||||
char escapeChar = readEscapeCharacter();
|
|
||||||
if (builder == null) {
|
if (builder == null) {
|
||||||
int estimatedLength = (len + pos - p) * 2;
|
int estimatedLength = (len + 1) * 2;
|
||||||
builder = new StringBuilder(Math.max(estimatedLength, 16));
|
builder = new StringBuilder(Math.max(estimatedLength, 16));
|
||||||
}
|
}
|
||||||
builder.append(buffer, start, len);
|
builder.append(buffer, start, len);
|
||||||
builder.append(escapeChar);
|
builder.append(readEscapeCharacter());
|
||||||
p = pos;
|
p = pos;
|
||||||
l = limit;
|
l = limit;
|
||||||
start = p;
|
start = p;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user