Class JsonTokenStream

  • All Implemented Interfaces:
    Versioned, java.io.Closeable, java.lang.AutoCloseable

    public class JsonTokenStream
    extends JsonParser
    This class gives a way to keep json data in different types of source (file, string or byte array) and to process this data through sequence of json tokens. The difference of this class comparing to standard UTF8StreamJsonParser or ReaderBasedJsonParser is that here we can deal with large text values since they are processed as whole tokens in standard jackson approach. Here we substitute these large text values by special keywords storing mapping from these keywords to position of real text in character stream. This mapping is stored in largeStringPos. For that we wrap input reader before parsing it into tokens by wrapper searching these large texts (see getWrapperForLargeStrings method for Reader for details). And during writing operation we wrap output writer by wrapper substituting these keywords back into large strings (see getWrapperForLargeStrings for Writer). For searching large string by stored position LargeStringSearchingReader is used by calling getLargeStringReader method. Another useful feature which is not present in standard parsers is tracking current json path. Even more, you can define json path as a root point for your token stream and after that this stream will provide tokens only from subtree of your json data deeper than root path. This feature is important for UObject creation based on fragment in bigger json data covered by JsonTokenStream.