Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2007 Mozilla Foundation
   *
   * Permission is hereby granted, free of charge, to any person obtaining a 
   * copy of this software and associated documentation files (the "Software"), 
   * to deal in the Software without restriction, including without limitation 
   * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
   * and/or sell copies of the Software, and to permit persons to whom the 
   * Software is furnished to do so, subject to the following conditions:
  *
  * The above copyright notice and this permission notice shall be included in 
  * all copies or substantial portions of the Software.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
  * DEALINGS IN THE SOFTWARE.
  */
 
 package nu.validator.json;
 
A SAX-inspired streaming interface for JSON. This interface is biased towards streaming writing whereas SAX is biased towards streaming parsing.

Author(s):
hsivonen
Version:
$Id$
 
 public interface JsonHandler {

    
Reports the start of the JSON file. When callback is null, the file is a pure JSON file. With a non-null callback, a JSON value is wrapped in a function call named callback.

Note that the JSON null value is represented as string(null).

Parameters:
callback JavaScript callback function name or null for pure JSON.
Throws:
org.xml.sax.SAXException if bad things happen
 
     public void startDocument(String callbackthrows SAXException;

    
Reports the end of the JSON file. Must be called finally.

Throws:
org.xml.sax.SAXException if bad things happen
 
     public void endDocument() throws SAXException;

    
Reports the start of an array.

Throws:
org.xml.sax.SAXException if bad things happen
 
     public void startArray() throws SAXException;

    
Reports the end of an array.

Throws:
org.xml.sax.SAXException if bad things happen
 
     public void endArray() throws SAXException;

    
Reports the start of an object.

Throws:
org.xml.sax.SAXException if bad things happen
     
     public void startObject() throws SAXException;

    
Starts a key-value pair inside an object. The parameter key gives the key and the next reported value is taken to be the value associated with the key. (Hence, there is no need for a corresponding end callback.)

Parameters:
key the key for the key-value pair (must not be null)
Throws:
org.xml.sax.SAXException if bad things happen
 
     public void key(String keythrows SAXException;

    
Reports the end of an object.

Throws:
org.xml.sax.SAXException if bad things happen
     
     public void endObject() throws SAXException;

    
Reports the start of a string.

Throws:
org.xml.sax.SAXException if bad things happen
    
    public void startString() throws SAXException;

    
Adds characters to the current string started with startString().

Parameters:
ch a buffer of UTF-16 code units
start the first code unit to read
length the number of code units to read
Throws:
org.xml.sax.SAXException if bad things happen
    public void characters(char[] chint startint lengththrows SAXException;

    
Reports the end of a string.

Throws:
org.xml.sax.SAXException if bad things happen
    
    public void endString() throws SAXException;    
    
    
Reports a JSON null on null and a string otherwise.

When the argument is not null, this method is shorthand for

startString();
 characters(string.toCharArray(), 0, string.length());
 endString();

Parameters:
string a string or null
Throws:
org.xml.sax.SAXException if bad things happen
    public void string(String stringthrows SAXException;    
    
    
Reports a number.

Parameters:
number the number
Throws:
org.xml.sax.SAXException if bad things happen
    public void number(int numberthrows SAXException;    
    
    
Reports a number.

Parameters:
number the number
Throws:
org.xml.sax.SAXException if bad things happen
    public void number(long numberthrows SAXException;    

    
Reports a number.

Parameters:
number the number
Throws:
org.xml.sax.SAXException if bad things happen
    public void number(float numberthrows SAXException;    

    
Reports a number.

Parameters:
number the number
Throws:
org.xml.sax.SAXException if bad things happen
    public void number(double numberthrows SAXException;    

    
Reports a boolean.

Parameters:
bool the boolean
Throws:
org.xml.sax.SAXException if bad things happen
    public void bool(boolean boolthrows SAXException;    
New to GrepCode? Check out our FAQ X