org.apache.hadoop.record
Class XmlRecordOutput

java.lang.Object
  extended by org.apache.hadoop.record.XmlRecordOutput
All Implemented Interfaces:
RecordOutput

public class XmlRecordOutput
extends Object
implements RecordOutput

XML Serializer.


Constructor Summary
XmlRecordOutput(OutputStream out)
          Creates a new instance of XmlRecordOutput
 
Method Summary
 void endMap(TreeMap v, 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.
 void startMap(TreeMap v, 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

XmlRecordOutput

public XmlRecordOutput(OutputStream out)
Creates a new instance of XmlRecordOutput

Method Detail

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

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

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

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

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

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

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

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

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

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

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

startMap

public void startMap(TreeMap v,
                     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:
v - Map to be serialized
tag - Used by tagged serialization formats (such as XML)
Throws:
IOException - Indicates error in serialization

endMap

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

Specified by:
endMap in interface RecordOutput
Parameters:
v - 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