@ThreadSafe @Immutable public class JsonReader extends Object
This reader is capable of optionally introspecting string values to look for certain string patterns that are commonly used to represent dates. In introspection is not done by default, but when it is used it looks for the following patterns:
"yyyy-MM-ddTHH:mm:ss" where
 T is a literal character"yyyy-MM-ddTHH:mm:ssZ" where
 T and Z are literal characters"yyyy-MM-ddTHH:mm:ssGMT+00:00" where T, and
 GMT are literal characters"/Date(millisOrIso)/""\/Date(millisOrIso)\/"millisOrIso is either a long value representing the number of
 milliseconds since epoch or a string literal in ISO-8601 format representing a date and time.
 
 This reader also accepts non-string values that are function calls of the form
     new functionName(parameters)
 
 
 where parameters consists of one or more JSON values (including nested functions). If the function call
 cannot be parsed and executed, the string literal form of the function call is kept.
 | Modifier and Type | Class and Description | 
|---|---|
| static class  | JsonReader.DateValueMatcherThe component that parses a tokenized JSON stream and attempts to evaluate literal values such as dates | 
| static class  | JsonReader.ParserThe component that parses a tokenized JSON stream. | 
| static class  | JsonReader.SimpleValueMatcherThe component that matches a string value for certain patterns. | 
| static class  | JsonReader.TokenizerThe component that tokenizes a stream of JSON content. | 
| static interface  | JsonReader.ValueMatcherThe component that matches a string value for certain patterns. | 
| Modifier and Type | Field and Description | 
|---|---|
| protected static JsonReader.ValueMatcher | DATE_VALUE_MATCHER | 
| static boolean | DEFAULT_INTROSPECT | 
| protected static JsonReader.ValueMatcher | SIMPLE_VALUE_MATCHER | 
| protected static DocumentValueFactory | VALUE_FACTORY | 
| Constructor and Description | 
|---|
| JsonReader() | 
| Modifier and Type | Method and Description | 
|---|---|
| static Number | parseNumber(String value)Parse the number represented by the supplied (unquoted) JSON field value. | 
| Document | read(InputStream stream)Read the JSON representation from supplied input stream and construct the  Documentrepresentation, using thedefault character set. | 
| Document | read(InputStream stream,
    boolean introspectStringValues)Read the JSON representation from supplied input stream and construct the  Documentrepresentation, using thedefault character set. | 
| Document | read(InputStream stream,
    Charset charset)Read the JSON representation from supplied input stream and construct the  Documentrepresentation, using the
 suppliedcharacter set. | 
| Document | read(InputStream stream,
    Charset charset,
    boolean introspectStringValues)Read the JSON representation from supplied input stream and construct the  Documentrepresentation, using the
 suppliedcharacter set. | 
| Document | read(Reader reader)Read the JSON representation from supplied input stream and construct the  Documentrepresentation. | 
| Document | read(Reader reader,
    boolean introspectStringValues)Read the JSON representation from supplied input stream and construct the  Documentrepresentation. | 
| Document | read(String json)Read the JSON representation from supplied string and construct the  Documentrepresentation. | 
| Document | read(String json,
    boolean introspectStringValues)Read the JSON representation from supplied string and construct the  Documentrepresentation. | 
| Document | read(URL url)Read the JSON representation from supplied URL and construct the  Documentrepresentation, using thedefault character set. | 
| DocumentSequence | readMultiple(InputStream stream)Return a  DocumentSequencethat can be used to pull multiple documents from the stream. | 
| DocumentSequence | readMultiple(InputStream stream,
            boolean introspectStringValues)Return a  DocumentSequencethat can be used to pull multiple documents from the stream. | 
| DocumentSequence | readMultiple(Reader reader)Return a  DocumentSequencethat can be used to pull multiple documents from the stream. | 
| DocumentSequence | readMultiple(Reader reader,
            boolean introspectStringValues)Return a  DocumentSequencethat can be used to pull multiple documents from the stream. | 
protected static final DocumentValueFactory VALUE_FACTORY
protected static final JsonReader.ValueMatcher SIMPLE_VALUE_MATCHER
protected static final JsonReader.ValueMatcher DATE_VALUE_MATCHER
public static final boolean DEFAULT_INTROSPECT
public Document read(URL url) throws ParsingException
Document representation, using the
 default character set.url - the URL to the JSON document; may not be null and must be resolvableDocument representationParsingException - if there was a problem reading from the URLpublic Document read(InputStream stream) throws ParsingException
Document representation, using the
 default character set.stream - the input stream; may not be nullDocument representationParsingException - if there was a problem reading from the streampublic Document read(InputStream stream, Charset charset) throws ParsingException
Document representation, using the
 supplied character set.stream - the input stream; may not be nullcharset - the character set that should be used; may not be nullDocument representationParsingException - if there was a problem reading from the streampublic Document read(Reader reader) throws ParsingException
Document representation.reader - the IO reader; may not be nullDocument representationParsingException - if there was a problem reading from the streampublic Document read(String json) throws ParsingException
Document representation.json - the JSON representation; may not be nullDocument representationParsingException - if there was a problem reading from the streampublic Document read(InputStream stream, boolean introspectStringValues) throws ParsingException
Document representation, using the
 default character set.stream - the input stream; may not be nullintrospectStringValues - true if the string values should be examined for common patterns, or false otherwiseDocument representationParsingException - if there was a problem reading from the streampublic Document read(InputStream stream, Charset charset, boolean introspectStringValues) throws ParsingException
Document representation, using the
 supplied character set.stream - the input stream; may not be nullcharset - the character set that should be used; may not be nullintrospectStringValues - true if the string values should be examined for common patterns, or false otherwiseDocument representationParsingException - if there was a problem reading from the streampublic Document read(Reader reader, boolean introspectStringValues) throws ParsingException
Document representation.reader - the IO reader; may not be nullintrospectStringValues - true if the string values should be examined for common patterns, or false otherwiseDocument representationParsingException - if there was a problem reading from the streampublic Document read(String json, boolean introspectStringValues) throws ParsingException
Document representation.json - the JSON representation; may not be nullintrospectStringValues - true if the string values should be examined for common patterns, or false otherwiseDocument representationParsingException - if there was a problem reading from the streampublic DocumentSequence readMultiple(InputStream stream)
DocumentSequence that can be used to pull multiple documents from the stream.stream - the input stream; may not be nullpublic DocumentSequence readMultiple(InputStream stream, boolean introspectStringValues)
DocumentSequence that can be used to pull multiple documents from the stream.stream - the input stream; may not be nullintrospectStringValues - true if the string values should be examined for common patterns, or false otherwisepublic DocumentSequence readMultiple(Reader reader)
DocumentSequence that can be used to pull multiple documents from the stream.reader - the IO reader; may not be nullpublic DocumentSequence readMultiple(Reader reader, boolean introspectStringValues)
DocumentSequence that can be used to pull multiple documents from the stream.reader - the IO reader; may not be nullintrospectStringValues - true if the string values should be examined for common patterns, or false otherwiseCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.