程序包 org.jsfr.json

类 JsonSurfer


  • public class JsonSurfer
    extends Object
    JsonSurfer traverses the whole json DOM tree, compare the path of each node with registered JsonPath and return the matched value immediately. JsonSurfer is fully streaming which means that it doesn't construct the DOM tree in memory.
    • 构造器详细资料

      • JsonSurfer

        public JsonSurfer​(JsonParserAdapter jsonParserAdapter,
                          JsonProvider jsonProvider)
        参数:
        jsonParserAdapter - jsonParserAdapter
        jsonProvider - jsonProvider
      • JsonSurfer

        public JsonSurfer​(JsonParserAdapter jsonParserAdapter,
                          JsonProvider jsonProvider,
                          ErrorHandlingStrategy errorHandlingStrategy)
        参数:
        jsonParserAdapter - jsonParserAdapter
        jsonProvider - jsonProvider
        errorHandlingStrategy - errorHandlingStrategy
    • 方法详细资料

      • configBuilder

        public SurfingConfiguration.Builder configBuilder()
        Create SurfingConfiguration builder associated with this surfer
        返回:
        SurfingConfiguration builder
      • iterator

        @Deprecated
        public Iterator<Object> iterator​(Reader reader,
                                         JsonPath jsonPath)
        已过时。
        Create a streaming iterator which can pull matched value one by one according to provided JsonPath. Internally, only one matched value stored in memory
        参数:
        reader - Json source
        jsonPath - JsonPath
        返回:
        Streaming iterator
      • iterator

        public Iterator<Object> iterator​(InputStream inputStream,
                                         JsonPath jsonPath)
        Create a streaming iterator which can pull matched value one by one according to provided JsonPath. Internally, only one matched value stored in memory
        参数:
        inputStream - Json source
        jsonPath - JsonPath
        返回:
        Streaming iterator
      • iterator

        public Iterator<Object> iterator​(String json,
                                         JsonPath jsonPath)
        Create a streaming iterator which can pull matched value one by one according to provided JsonPath. Internally, only one matched value stored in memory
        参数:
        json - Json source
        jsonPath - JsonPath
        返回:
        Streaming iterator
      • surf

        public void surf​(String json,
                         SurfingConfiguration configuration)
        Start surfing
        参数:
        json - json
        configuration - SurfingConfiguration that holds JsonPath binding
      • surf

        public void surf​(InputStream json,
                         SurfingConfiguration configuration)
        参数:
        json - Json InputStream
        configuration - SurfingConfiguration that holds JsonPath binding
      • createResumableParser

        public ResumableParser createResumableParser​(String json,
                                                     SurfingConfiguration configuration)
        Create resumable parser
        参数:
        json - Json source
        configuration - SurfingConfiguration
        返回:
        Resumable parser
      • createResumableParser

        public ResumableParser createResumableParser​(InputStream json,
                                                     SurfingConfiguration configuration)
        Create resumable parser
        参数:
        json - Json source
        configuration - SurfingConfiguration
        返回:
        Resumable parser
      • collector

        public Collector collector​(String json)
        Create collector object
        参数:
        json - Json string
        返回:
        collector
      • collector

        public Collector collector​(InputStream json)
        Create collector object
        参数:
        json - Json InputStream
        返回:
        collector
      • collectAll

        @Deprecated
        public <T> Collection<T> collectAll​(Reader reader,
                                            Class<T> tClass,
                                            JsonPath... paths)
        已过时。
        use collector(String) instead
        Collect all matched value into a collection
        类型参数:
        T - type
        参数:
        reader - Json reader
        tClass - type
        paths - JsonPath
        返回:
        typed value
      • collectOne

        @Deprecated
        public Object collectOne​(String json,
                                 String... paths)
        已过时。
        use collector(String) instead
        Collect the first matched value and stop parsing immediately
        参数:
        json - json
        paths - JsonPath
        返回:
        value
      • collectOne

        @Deprecated
        public Object collectOne​(String json,
                                 JsonPath... paths)
        已过时。
        use collector(String) instead
        Collect the first matched value and stop parsing immediately
        参数:
        json - json
        paths - JsonPath
        返回:
        value
      • collectOne

        @Deprecated
        public <T> T collectOne​(String json,
                                Class<T> tClass,
                                JsonPath... paths)
        已过时。
        use collector(String) instead
        类型参数:
        T - type
        参数:
        json - json
        tClass - type
        paths - JsonPath
        返回:
        value
      • collectOne

        @Deprecated
        public Object collectOne​(Reader reader,
                                 String... paths)
        已过时。
        Collect the first matched value and stop parsing immediately
        参数:
        reader - Json reader
        paths - JsonPath
        返回:
        Value
      • collectOne

        @Deprecated
        public Object collectOne​(Reader reader,
                                 JsonPath... paths)
        已过时。
        Collect the first matched value and stop parsing immediately
        参数:
        reader - json reader
        paths - JsonPath
        返回:
        Matched value
      • collectOne

        @Deprecated
        public <T> T collectOne​(Reader reader,
                                Class<T> tClass,
                                JsonPath... paths)
        已过时。
        Collect the first matched value and stop parsing immediately
        类型参数:
        T - type
        参数:
        reader - Json reader
        tClass - type
        paths - JsonPath
        返回:
        typed value
      • collectOne

        @Deprecated
        public <T> T collectOne​(InputStream inputStream,
                                Class<T> tClass,
                                JsonPath... paths)
        已过时。
        Collect the first matched value and stop parsing immediately
        类型参数:
        T - type
        参数:
        inputStream - Json inpustream
        tClass - type
        paths - JsonPath
        返回:
        typed value
      • getParserCharset

        public Charset getParserCharset()
      • setParserCharset

        public void setParserCharset​(Charset parserCharset)