public CBORJson(CharacterInputWithCount reader, JSONOptions options) { this.reader = reader; this.sb = null; this.options = options; this.jsonSequenceMode = false; this.recordSeparatorSeen = false; }
internal static CBORObject ParseJSONValue( CharacterInputWithCount reader, bool noDuplicates, bool objectOrArrayOnly, int[] nextchar) { var cj = new CBORJson(reader, noDuplicates); return cj.ParseJSON(objectOrArrayOnly, nextchar); }
internal static CBORObject ParseJSONValue( CharacterInputWithCount reader, JSONOptions options, int[] nextChar) { var cj = new CBORJson(reader, options); return(cj.ParseJSON(nextChar)); }
internal static CBORObject ParseJSONValue( CharacterInputWithCount reader, bool noDuplicates, bool objectOrArrayOnly, int[] nextchar) { var cj = new CBORJson(reader, noDuplicates); return(cj.ParseJSON(objectOrArrayOnly, nextchar)); }
// JSON parsing methods private static int SkipWhitespaceJSON(CharacterInputWithCount reader) { while (true) { int c = reader.ReadChar(); if (c == -1 || (c != 0x20 && c != 0x0a && c != 0x0d && c != 0x09)) { return(c); } } }
// JSON parsing methods private static int SkipWhitespaceJSON(CharacterInputWithCount reader) { while (true) { int c = reader.ReadChar(); if (c == -1 || (c != 0x20 && c != 0x0a && c != 0x0d && c != 0x09)) { return c; } } }
public CBORJson(CharacterInputWithCount reader, bool noDuplicates) { this.reader = reader; this.sb = null; this.noDuplicates = noDuplicates; }
internal static CBORObject[] ParseJSONSequence( CharacterInputWithCount reader, JSONOptions options, int[] nextChar) { var cj = new CBORJson(reader, options); cj.SetJSONSequenceMode(); bool seenSeparator = cj.SkipRecordSeparators(nextChar, false); if (nextChar[0] >= 0 && !seenSeparator) { // Stream is not empty and did not begin with // record separator cj.RaiseError("Not a JSON text sequence"); } else if (nextChar[0] < 0 && !seenSeparator) { // Stream is empty return(new CBORObject[0]); } else if (nextChar[0] < 0) { // Stream had only record separators, so we found // a truncated JSON text return(new CBORObject[] { null }); } var list = new List <CBORObject>(); while (true) { CBORObject co; try { co = cj.ParseJSON(nextChar); } catch (CBORException) { cj.SkipToEnd(); co = null; } if (co != null && nextChar[0] >= 0) { // End of JSON text not reached cj.SkipToEnd(); co = null; } list.Add(co); if (!cj.recordSeparatorSeen) { // End of the stream was reached nextChar[0] = -1; break; } else { // A record separator was seen, so // another JSON text follows cj.ResetJSONSequenceMode(); cj.SkipRecordSeparators(nextChar, true); if (nextChar[0] < 0) { // Rest of stream had only record separators, so we found // a truncated JSON text list.Add(null); break; } } } return((CBORObject[])list.ToArray()); }
public CBORJson(CharacterInputWithCount reader, bool noDuplicates) { this.reader = reader; this.sb = null; this.noDuplicates = noDuplicates; }