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