1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/mobile/android/thirdparty/org/json/simple/parser/ContentHandler.java Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,110 @@ 1.4 +package org.json.simple.parser; 1.5 + 1.6 +import java.io.IOException; 1.7 + 1.8 +/** 1.9 + * A simplified and stoppable SAX-like content handler for stream processing of JSON text. 1.10 + * 1.11 + * @see org.xml.sax.ContentHandler 1.12 + * @see org.json.simple.parser.JSONParser#parse(java.io.Reader, ContentHandler, boolean) 1.13 + * 1.14 + * @author FangYidong<fangyidong@yahoo.com.cn> 1.15 + */ 1.16 +public interface ContentHandler { 1.17 + /** 1.18 + * Receive notification of the beginning of JSON processing. 1.19 + * The parser will invoke this method only once. 1.20 + * 1.21 + * @throws ParseException 1.22 + * - JSONParser will stop and throw the same exception to the caller when receiving this exception. 1.23 + */ 1.24 + void startJSON() throws ParseException, IOException; 1.25 + 1.26 + /** 1.27 + * Receive notification of the end of JSON processing. 1.28 + * 1.29 + * @throws ParseException 1.30 + */ 1.31 + void endJSON() throws ParseException, IOException; 1.32 + 1.33 + /** 1.34 + * Receive notification of the beginning of a JSON object. 1.35 + * 1.36 + * @return false if the handler wants to stop parsing after return. 1.37 + * @throws ParseException 1.38 + * - JSONParser will stop and throw the same exception to the caller when receiving this exception. 1.39 + * @see #endJSON 1.40 + */ 1.41 + boolean startObject() throws ParseException, IOException; 1.42 + 1.43 + /** 1.44 + * Receive notification of the end of a JSON object. 1.45 + * 1.46 + * @return false if the handler wants to stop parsing after return. 1.47 + * @throws ParseException 1.48 + * 1.49 + * @see #startObject 1.50 + */ 1.51 + boolean endObject() throws ParseException, IOException; 1.52 + 1.53 + /** 1.54 + * Receive notification of the beginning of a JSON object entry. 1.55 + * 1.56 + * @param key - Key of a JSON object entry. 1.57 + * 1.58 + * @return false if the handler wants to stop parsing after return. 1.59 + * @throws ParseException 1.60 + * 1.61 + * @see #endObjectEntry 1.62 + */ 1.63 + boolean startObjectEntry(String key) throws ParseException, IOException; 1.64 + 1.65 + /** 1.66 + * Receive notification of the end of the value of previous object entry. 1.67 + * 1.68 + * @return false if the handler wants to stop parsing after return. 1.69 + * @throws ParseException 1.70 + * 1.71 + * @see #startObjectEntry 1.72 + */ 1.73 + boolean endObjectEntry() throws ParseException, IOException; 1.74 + 1.75 + /** 1.76 + * Receive notification of the beginning of a JSON array. 1.77 + * 1.78 + * @return false if the handler wants to stop parsing after return. 1.79 + * @throws ParseException 1.80 + * 1.81 + * @see #endArray 1.82 + */ 1.83 + boolean startArray() throws ParseException, IOException; 1.84 + 1.85 + /** 1.86 + * Receive notification of the end of a JSON array. 1.87 + * 1.88 + * @return false if the handler wants to stop parsing after return. 1.89 + * @throws ParseException 1.90 + * 1.91 + * @see #startArray 1.92 + */ 1.93 + boolean endArray() throws ParseException, IOException; 1.94 + 1.95 + /** 1.96 + * Receive notification of the JSON primitive values: 1.97 + * java.lang.String, 1.98 + * java.lang.Number, 1.99 + * java.lang.Boolean 1.100 + * null 1.101 + * 1.102 + * @param value - Instance of the following: 1.103 + * java.lang.String, 1.104 + * java.lang.Number, 1.105 + * java.lang.Boolean 1.106 + * null 1.107 + * 1.108 + * @return false if the handler wants to stop parsing after return. 1.109 + * @throws ParseException 1.110 + */ 1.111 + boolean primitive(Object value) throws ParseException, IOException; 1.112 + 1.113 +}