org.apache.hadoop.typedbytes
Class TypedBytesRecordOutput

java.lang.Object
  extended by org.apache.hadoop.typedbytes.TypedBytesRecordOutput
All Implemented Interfaces:
RecordOutput

public class TypedBytesRecordOutput
extends Object
implements RecordOutput

Deserialized for records that reads typed bytes.


Constructor Summary
TypedBytesRecordOutput(DataOutput out)
          Creates a new instance of TypedBytesRecordOutput.
TypedBytesRecordOutput(TypedBytesOutput out)
          Creates a new instance of TypedBytesRecordOutput.
 
Method Summary
 void endMap(TreeMap m, String tag)
          Mark the end of a serialized map.
 void endRecord(Record r, String tag)
          Mark the end of a serialized record.
 void endVector(ArrayList v, String tag)
          Mark the end of a serialized vector.
static TypedBytesRecordOutput get(DataOutput out)
          Get a thread-local typed bytes record output for the supplied DataOutput.
static TypedBytesRecordOutput get(TypedBytesOutput out)
          Get a thread-local typed bytes record input for the supplied TypedBytesOutput.
 void startMap(TreeMap m, String tag)
          Mark the start of a map to be serialized.
 void startRecord(Record r, String tag)
          Mark the start of a record to be serialized.
 void startVector(ArrayList v, String tag)
          Mark the start of a vector to be serialized.
 void writeBool(boolean b, String tag)
          Write a boolean to serialized record.
 void writeBuffer(Buffer buf, String tag)
          Write a buffer to serialized record.
 void writeByte(byte b, String tag)
          Write a byte to serialized record.
 void writeDouble(double d, String tag)
          Write a double precision floating point number to serialized record.
 void writeFloat(float f, String tag)
          Write a single-precision float to serialized record.
 void writeInt(int i, String tag)
          Write an integer to serialized record.
 void writeLong(long l, String tag)
          Write a long integer to serialized record.
 void writeString(String s, String tag)
          Write a unicode string to serialized record.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypedBytesRecordOutput

public TypedBytesRecordOutput(TypedBytesOutput out)
Creates a new instance of TypedBytesRecordOutput.


TypedBytesRecordOutput

public TypedBytesRecordOutput(DataOutput out)
Creates a new instance of TypedBytesRecordOutput.

Method Detail

get

public static TypedBytesRecordOutput get(TypedBytesOutput out)
Get a thread-local typed bytes record input for the supplied TypedBytesOutput.

Parameters:
out - typed bytes output object
Returns:
typed bytes record output corresponding to the supplied TypedBytesOutput.

get

public static TypedBytesRecordOutput get(DataOutput out)
Get a thread-local typed bytes record output for the supplied DataOutput.

Parameters:
out - data output object
Returns:
typed bytes record output corresponding to the supplied DataOutput.

writeBool

public void writeBool(boolean b,
                      String tag)
               throws IOException
Description copied from interface: RecordOutput
Write a boolean to serialized record.

Specified by:
writeBool in interface RecordOutput
Parameters:
b - Boolean to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

writeBuffer

public void writeBuffer(Buffer buf,
                        String tag)
                 throws IOException
Description copied from interface: RecordOutput
Write a buffer to serialized record.

Specified by:
writeBuffer in interface RecordOutput
Parameters:
buf - Buffer to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

writeByte

public void writeByte(byte b,
                      String tag)
               throws IOException
Description copied from interface: RecordOutput
Write a byte to serialized record.

Specified by:
writeByte in interface RecordOutput
Parameters:
b - Byte to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

writeDouble

public void writeDouble(double d,
                        String tag)
                 throws IOException
Description copied from interface: RecordOutput
Write a double precision floating point number to serialized record.

Specified by:
writeDouble in interface RecordOutput
Parameters:
d - Double to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

writeFloat

public void writeFloat(float f,
                       String tag)
                throws IOException
Description copied from interface: RecordOutput
Write a single-precision float to serialized record.

Specified by:
writeFloat in interface RecordOutput
Parameters:
f - Float to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

writeInt

public void writeInt(int i,
                     String tag)
              throws IOException
Description copied from interface: RecordOutput
Write an integer to serialized record.

Specified by:
writeInt in interface RecordOutput
Parameters:
i - Integer to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

writeLong

public void writeLong(long l,
                      String tag)
               throws IOException
Description copied from interface: RecordOutput
Write a long integer to serialized record.

Specified by:
writeLong in interface RecordOutput
Parameters:
l - Long to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

writeString

public void writeString(String s,
                        String tag)
                 throws IOException
Description copied from interface: RecordOutput
Write a unicode string to serialized record.

Specified by:
writeString in interface RecordOutput
Parameters:
s - String to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

startRecord

public void startRecord(Record r,
                        String tag)
                 throws IOException
Description copied from interface: RecordOutput
Mark the start of a record to be serialized.

Specified by:
startRecord in interface RecordOutput
Parameters:
r - Record to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

startVector

public void startVector(ArrayList v,
                        String tag)
                 throws IOException
Description copied from interface: RecordOutput
Mark the start of a vector to be serialized.

Specified by:
startVector in interface RecordOutput
Parameters:
v - Vector to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

startMap

public void startMap(TreeMap m,
                     String tag)
              throws IOException
Description copied from interface: RecordOutput
Mark the start of a map to be serialized.

Specified by:
startMap in interface RecordOutput
Parameters:
m - Map to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

endRecord

public void endRecord(Record r,
                      String tag)
               throws IOException
Description copied from interface: RecordOutput
Mark the end of a serialized record.

Specified by:
endRecord in interface RecordOutput
Parameters:
r - Record to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

endVector

public void endVector(ArrayList v,
                      String tag)
               throws IOException
Description copied from interface: RecordOutput
Mark the end of a serialized vector.

Specified by:
endVector in interface RecordOutput
Parameters:
v - Vector to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

endMap

public void endMap(TreeMap m,
                   String tag)
            throws IOException
Description copied from interface: RecordOutput
Mark the end of a serialized map.

Specified by:
endMap in interface RecordOutput
Parameters:
m - Map to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization


Copyright © 2009 The Apache Software Foundation