tl.lin.data
Class JsonWritable

java.lang.Object
  extended by tl.lin.data.JsonWritable
All Implemented Interfaces:
org.apache.hadoop.io.Writable

public class JsonWritable
extends Object
implements org.apache.hadoop.io.Writable

Writable representing a JSON object.


Constructor Summary
JsonWritable()
          Creates an empty JsonWritable.
JsonWritable(String s)
          Creates a JsonWritable with an initial value.
 
Method Summary
static JsonWritable create(byte[] bytes)
           
static JsonWritable create(DataInput in)
           
 com.google.gson.JsonObject getJsonObject()
           
 void readFields(DataInput in)
          Deserializes a JsonWritable object.
 byte[] serialize()
          Returns the serialized representation of this object as a byte array.
 String toString()
           
 void write(DataOutput out)
          Serializes this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JsonWritable

public JsonWritable()
Creates an empty JsonWritable.


JsonWritable

public JsonWritable(String s)
Creates a JsonWritable with an initial value.

Method Detail

readFields

public void readFields(DataInput in)
                throws IOException
Deserializes a JsonWritable object.

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Parameters:
in - source for raw byte representation
Throws:
IOException

write

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

Specified by:
write in interface org.apache.hadoop.io.Writable
Parameters:
out - where to write the raw byte representation
Throws:
IOException

serialize

public byte[] serialize()
                 throws IOException
Returns the serialized representation of this object as a byte array.

Returns:
byte array representing the serialized representation of this object
Throws:
IOException

getJsonObject

public com.google.gson.JsonObject getJsonObject()

toString

public String toString()
Overrides:
toString in class Object

create

public static JsonWritable create(DataInput in)
                           throws IOException
Throws:
IOException

create

public static JsonWritable create(byte[] bytes)
                           throws IOException
Throws:
IOException


Copyright © 2013. All Rights Reserved.