com.esri.arcgis.system
Class JSONReader

java.lang.Object
  extended by com.esri.arcgis.system.JSONReader
All Implemented Interfaces:
com.esri.arcgis.interop.RemoteObjRef, IJSONReader, ISupportErrorInfo, Serializable

public class JSONReader
extends Object
implements com.esri.arcgis.interop.RemoteObjRef, IJSONReader, ISupportErrorInfo

A sequential JSON Reader.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

See Also:
Serialized Form

Constructor Summary
JSONReader()
          Constructs a JSONReader using ArcGIS Engine.
JSONReader(Object obj)
          Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
JSONReader theJSONReader = (JSONReader) obj;
 
Method Summary
 boolean equals(Object o)
          Compare this object with another
 int findProperties(IStringArray propnames)
          Reads current object until one of property names matches.
 boolean findProperty(String propname)
          Reads current object until property name matches or object ends.
static String getClsid()
          getClsid.
 int getCurrentTokenType()
          Obtains type of current token.
 IStream getStream()
          Obtains underlying stream.
 int hashCode()
          the hashcode for this object
 void interfaceSupportsErrorInfo(GUID riid)
          interfaceSupportsErrorInfo
 boolean isBoolean()
          Indicates true if current token is a property value or array value of boolean type.
 boolean isEndOfArray()
          Indicates true if current token is ']'.
 boolean isEndOfObject()
          Indicates true if current token is '}'.
 boolean isNull()
          Indicates true if current token is a property value or array value and equals to null.
 boolean isNumber()
          Indicates true if current token is a property value or array value of numeric type.
 boolean isStartOfArray()
          Indicates true if current token is '['.
 boolean isStartOfObject()
          Indicates true if current token is '{'.
 boolean isString()
          Indicates true if current token is a property value or array value of type string.
 void read()
          Reads next JSON token.
 void readFrom(IStream inputStream)
          Specifies input stream.
 void readFromString(String text)
          Specifies input as string.
 String readPropertyName()
          Obtains property name.
 Object readValue()
          Obtains array or property value as Variant.
 boolean readValueAsBoolean()
          Obtains array or property value as boolean.
 Date readValueAsDate()
          Obtains property or array value as date.
 double readValueAsDouble()
          Obtains property or array value as number.
 int readValueAsLong()
          Obtains property or array value as number.
 String readValueAsString()
          Obtains property or array value as string.
 void skipUntilArrayEnds()
          Skips the rest of the current object, including closing bracket.
 void skipUntilObjectEnds()
          Skips the rest of the current object, including closing bracket.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.esri.arcgis.interop.RemoteObjRef
getJintegraDispatch, release
 

Constructor Detail

JSONReader

public JSONReader()
           throws IOException,
                  UnknownHostException
Constructs a JSONReader using ArcGIS Engine.

Throws:
IOException - if there are interop problems
UnknownHostException - if there are interop problems

JSONReader

public JSONReader(Object obj)
           throws IOException
Deprecated. As of ArcGIS 9.2, replaced by normal Java casts.
JSONReader theJSONReader = (JSONReader) obj;

Construct a JSONReader using a reference to such an object returned from ArcGIS Engine or Server. This is semantically equivalent to casting obj to JSONReader.

Parameters:
obj - an object returned from ArcGIS Engine or Server
Throws:
IOException - if there are interop problems
Method Detail

getClsid

public static String getClsid()
getClsid.


equals

public boolean equals(Object o)
Compare this object with another

Overrides:
equals in class Object

hashCode

public int hashCode()
the hashcode for this object

Overrides:
hashCode in class Object

readFrom

public void readFrom(IStream inputStream)
              throws IOException,
                     AutomationException
Specifies input stream.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readFrom in interface IJSONReader
Parameters:
inputStream - A reference to a com.esri.arcgis.system.IStream (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readFromString

public void readFromString(String text)
                    throws IOException,
                           AutomationException
Specifies input as string.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readFromString in interface IJSONReader
Parameters:
text - The text (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getStream

public IStream getStream()
                  throws IOException,
                         AutomationException
Obtains underlying stream.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getStream in interface IJSONReader
Returns:
A reference to a com.esri.arcgis.system.IStream
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

read

public void read()
          throws IOException,
                 AutomationException
Reads next JSON token.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
read in interface IJSONReader
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

getCurrentTokenType

public int getCurrentTokenType()
                        throws IOException,
                               AutomationException
Obtains type of current token.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
getCurrentTokenType in interface IJSONReader
Returns:
A com.esri.arcgis.system.JSONTokenType constant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isStartOfObject

public boolean isStartOfObject()
                        throws IOException,
                               AutomationException
Indicates true if current token is '{'.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isStartOfObject in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isEndOfObject

public boolean isEndOfObject()
                      throws IOException,
                             AutomationException
Indicates true if current token is '}'.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isEndOfObject in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isStartOfArray

public boolean isStartOfArray()
                       throws IOException,
                              AutomationException
Indicates true if current token is '['.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isStartOfArray in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isEndOfArray

public boolean isEndOfArray()
                     throws IOException,
                            AutomationException
Indicates true if current token is ']'.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isEndOfArray in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isString

public boolean isString()
                 throws IOException,
                        AutomationException
Indicates true if current token is a property value or array value of type string.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isString in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isNumber

public boolean isNumber()
                 throws IOException,
                        AutomationException
Indicates true if current token is a property value or array value of numeric type.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isNumber in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isBoolean

public boolean isBoolean()
                  throws IOException,
                         AutomationException
Indicates true if current token is a property value or array value of boolean type.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isBoolean in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

isNull

public boolean isNull()
               throws IOException,
                      AutomationException
Indicates true if current token is a property value or array value and equals to null.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
isNull in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readValue

public Object readValue()
                 throws IOException,
                        AutomationException
Obtains array or property value as Variant. Advances to the next token.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readValue in interface IJSONReader
Returns:
A Variant
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readPropertyName

public String readPropertyName()
                        throws IOException,
                               AutomationException
Obtains property name. Advances to the next token.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readPropertyName in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readValueAsString

public String readValueAsString()
                         throws IOException,
                                AutomationException
Obtains property or array value as string. Advances to the next token. If property value cannot be coerced to string, returns E_FAIL.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readValueAsString in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readValueAsLong

public int readValueAsLong()
                    throws IOException,
                           AutomationException
Obtains property or array value as number. Advances to the next token. If property value cannot be coerced to long, returns E_FAIL.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readValueAsLong in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readValueAsDouble

public double readValueAsDouble()
                         throws IOException,
                                AutomationException
Obtains property or array value as number. Advances to the next token. If property value cannot be coerced to double, returns E_FAIL.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readValueAsDouble in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readValueAsBoolean

public boolean readValueAsBoolean()
                           throws IOException,
                                  AutomationException
Obtains array or property value as boolean. Advances to the next token. If property value cannot be coerced to boolean, returns E_FAIL.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readValueAsBoolean in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

readValueAsDate

public Date readValueAsDate()
                     throws IOException,
                            AutomationException
Obtains property or array value as date. Advances to the next token. If property value cannot be coerced to datetime, returns E_FAIL.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
readValueAsDate in interface IJSONReader
Returns:
The pVal
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

findProperty

public boolean findProperty(String propname)
                     throws IOException,
                            AutomationException
Reads current object until property name matches or object ends. Case is ignored.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
findProperty in interface IJSONReader
Parameters:
propname - The propname (in)
Returns:
The found
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

findProperties

public int findProperties(IStringArray propnames)
                   throws IOException,
                          AutomationException
Reads current object until one of property names matches. Case is ignored. Return value is an index of property name that matched, otherwise -1.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
findProperties in interface IJSONReader
Parameters:
propnames - A reference to a com.esri.arcgis.system.IStringArray (in)
Returns:
The index
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

skipUntilObjectEnds

public void skipUntilObjectEnds()
                         throws IOException,
                                AutomationException
Skips the rest of the current object, including closing bracket.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
skipUntilObjectEnds in interface IJSONReader
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

skipUntilArrayEnds

public void skipUntilArrayEnds()
                        throws IOException,
                               AutomationException
Skips the rest of the current object, including closing bracket.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Specified by:
skipUntilArrayEnds in interface IJSONReader
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.

interfaceSupportsErrorInfo

public void interfaceSupportsErrorInfo(GUID riid)
                                throws IOException,
                                       AutomationException
interfaceSupportsErrorInfo

Description

Indicates whether the interface supports IErrorInfo.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Specified by:
interfaceSupportsErrorInfo in interface ISupportErrorInfo
Parameters:
riid - A Structure: com.esri.arcgis.support.ms.stdole.GUID (in)
Throws:
IOException - If there are interop problems.
AutomationException - If the ArcObject component throws an exception.