Clover icon

Coverage Report

  1. Project Clover database Mon Nov 18 2024 09:38:20 GMT
  2. Package org.json.simple.parser

File ContentHandler.java

 

Code metrics

0
0
0
1
111
14
0
-
-
0
-

Classes

Class Line # Actions
ContentHandler 15 0 0
-1.0 -
 

Contributing tests

No tests hitting this source file were found.

Source view

1    package org.json.simple.parser;
2   
3    import java.io.IOException;
4   
5    /**
6    * A simplified and stoppable SAX-like content handler for stream processing of
7    * JSON text.
8    *
9    * @see org.xml.sax.ContentHandler
10    * @see org.json.simple.parser.JSONParser#parse(java.io.Reader, ContentHandler,
11    * boolean)
12    *
13    * @author FangYidong<fangyidong@yahoo.com.cn>
14    */
 
15    public interface ContentHandler
16    {
17    /**
18    * Receive notification of the beginning of JSON processing. The parser will
19    * invoke this method only once.
20    *
21    * @throws ParseException
22    * - JSONParser will stop and throw the same exception to the caller
23    * when receiving this exception.
24    */
25    void startJSON() throws ParseException, IOException;
26   
27    /**
28    * Receive notification of the end of JSON processing.
29    *
30    * @throws ParseException
31    */
32    void endJSON() throws ParseException, IOException;
33   
34    /**
35    * Receive notification of the beginning of a JSON object.
36    *
37    * @return false if the handler wants to stop parsing after return.
38    * @throws ParseException
39    * - JSONParser will stop and throw the same exception to the caller
40    * when receiving this exception.
41    * @see #endJSON
42    */
43    boolean startObject() throws ParseException, IOException;
44   
45    /**
46    * Receive notification of the end of a JSON object.
47    *
48    * @return false if the handler wants to stop parsing after return.
49    * @throws ParseException
50    *
51    * @see #startObject
52    */
53    boolean endObject() throws ParseException, IOException;
54   
55    /**
56    * Receive notification of the beginning of a JSON object entry.
57    *
58    * @param key
59    * - Key of a JSON object entry.
60    *
61    * @return false if the handler wants to stop parsing after return.
62    * @throws ParseException
63    *
64    * @see #endObjectEntry
65    */
66    boolean startObjectEntry(String key) throws ParseException, IOException;
67   
68    /**
69    * Receive notification of the end of the value of previous object entry.
70    *
71    * @return false if the handler wants to stop parsing after return.
72    * @throws ParseException
73    *
74    * @see #startObjectEntry
75    */
76    boolean endObjectEntry() throws ParseException, IOException;
77   
78    /**
79    * Receive notification of the beginning of a JSON array.
80    *
81    * @return false if the handler wants to stop parsing after return.
82    * @throws ParseException
83    *
84    * @see #endArray
85    */
86    boolean startArray() throws ParseException, IOException;
87   
88    /**
89    * Receive notification of the end of a JSON array.
90    *
91    * @return false if the handler wants to stop parsing after return.
92    * @throws ParseException
93    *
94    * @see #startArray
95    */
96    boolean endArray() throws ParseException, IOException;
97   
98    /**
99    * Receive notification of the JSON primitive values: java.lang.String,
100    * java.lang.Number, java.lang.Boolean null
101    *
102    * @param value
103    * - Instance of the following: java.lang.String, java.lang.Number,
104    * java.lang.Boolean null
105    *
106    * @return false if the handler wants to stop parsing after return.
107    * @throws ParseException
108    */
109    boolean primitive(Object value) throws ParseException, IOException;
110   
111    }