修复json在ByteBuffer、InputSteam参数下无法解决数组的问题
This commit is contained in:
@@ -132,6 +132,7 @@ public class JsonByteBufferReader extends JsonReader {
|
|||||||
if (ch == 'N' && nextChar() == 'U' && nextChar() == 'L' && nextChar() == 'L') {
|
if (ch == 'N' && nextChar() == 'U' && nextChar() == 'L' && nextChar() == 'L') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
int pos = this.position;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append(ch);
|
sb.append(ch);
|
||||||
char one;
|
char one;
|
||||||
@@ -139,7 +140,7 @@ public class JsonByteBufferReader extends JsonReader {
|
|||||||
while ((one = nextChar()) != 0) sb.append(one);
|
while ((one = nextChar()) != 0) sb.append(one);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
}
|
}
|
||||||
throw new ConvertException("a json object text must begin with '{' (position = " + position + ") but '" + ch + "' in (" + sb + ")");
|
throw new ConvertException("a json object text must begin with '{' (position = " + pos + ") but '" + ch + "' in (" + sb + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -365,13 +365,13 @@ public class JsonReader extends Reader {
|
|||||||
if (nt == '}' || nt == ']') {
|
if (nt == '}' || nt == ']') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.position--;
|
backChar(ch);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (ch == '}' || ch == ']') {
|
if (ch == '}' || ch == ']') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.position--; // { [ 交由 readObjectB 或 readMapB 或 readArrayB 读取
|
backChar(ch); // { [ 交由 readObjectB 或 readMapB 或 readArrayB 读取
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user