edu.umd.cloud9.io
Class JSONObjectWritable

java.lang.Object
  extended by org.json.JSONObject
      extended by edu.umd.cloud9.io.JSONObjectWritable
All Implemented Interfaces:
Writable
Direct Known Subclasses:
BigramRelativeFrequencyJSON.MyTuple, DemoWordCountJSON.MyKey

public class JSONObjectWritable
extends JSONObject
implements Writable

Writable representing a JSON Object.

Author:
Jimmy Lin

Field Summary
 
Fields inherited from class org.json.JSONObject
NULL
 
Constructor Summary
JSONObjectWritable()
          Creates an empty JSONWritableObject.
JSONObjectWritable(String s)
          Creates a JSONWritableObject with an initial value.
 
Method Summary
 void clear()
           
 boolean getBooleanUnchecked(String key)
           
 double getDoubleUnchecked(String key)
           
 int getIntUnchecked(String key)
           
 long getLongUnchecked(String key)
           
 String getStringUnchecked(String key)
           
 void readFields(DataInput in)
          Deserializes the JSON object.
 void readJSONObject(String s)
          Deserializes a JSON object from a string representation.
 void write(DataOutput out)
          Serializes this JSON object.
 
Methods inherited from class org.json.JSONObject
accumulate, append, doubleToString, get, getBoolean, getDouble, getInt, getJSONArray, getJSONObject, getLong, getNames, getNames, getString, has, isNull, keys, length, names, numberToString, opt, optBoolean, optBoolean, optDouble, optDouble, optInt, optInt, optJSONArray, optJSONObject, optLong, optLong, optString, optString, put, put, put, put, put, put, put, putOpt, quote, remove, sortedKeys, toJSONArray, toString, toString, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JSONObjectWritable

public JSONObjectWritable()
Creates an empty JSONWritableObject.


JSONObjectWritable

public JSONObjectWritable(String s)
                   throws JSONException
Creates a JSONWritableObject with an initial value.

Throws:
JSONException
Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Deserializes the JSON object.

Specified by:
readFields in interface Writable
Parameters:
in - source for raw byte representation
Throws:
IOException

readJSONObject

public void readJSONObject(String s)
Deserializes a JSON object from a string representation.

Parameters:
s - string representation of the JSON object

write

public void write(DataOutput out)
           throws IOException
Serializes this JSON object.

Specified by:
write in interface Writable
Parameters:
out - where to write the raw byte representation
Throws:
IOException

getBooleanUnchecked

public boolean getBooleanUnchecked(String key)
                            throws JSONException
Throws:
JSONException

getDoubleUnchecked

public double getDoubleUnchecked(String key)
                          throws JSONException
Throws:
JSONException

getIntUnchecked

public int getIntUnchecked(String key)
                    throws JSONException
Throws:
JSONException

getLongUnchecked

public long getLongUnchecked(String key)
                      throws JSONException
Throws:
JSONException

getStringUnchecked

public String getStringUnchecked(String key)
                          throws JSONException
Throws:
JSONException

clear

public void clear()