com.google.gdata.wireformats
Class WireFormat

java.lang.Object
  extended by com.google.gdata.wireformats.WireFormat
Direct Known Subclasses:
XmlWireFormat

public abstract class WireFormat
extends java.lang.Object

Top-level information about a wire format. All wire formats have an associated generator and parser, plus a method to validate content model metadata to ensure it's compatible with the wire format.


Field Summary
static java.util.List<WireFormat> ALL
          List of all supported wire formats.
protected  java.lang.String name
          Logical name for the wire format.
static XmlWireFormat XML
          XML wire format.
 
Constructor Summary
protected WireFormat(java.lang.String name)
          Constructs a new wire format with the specific logical name.
 
Method Summary
abstract  WireFormatGenerator createGenerator(OutputProperties outProps, java.io.Writer w, java.nio.charset.Charset cs, boolean prettyPrint)
          Create a wire format generator.
abstract  WireFormatParser createParser(InputProperties inProps, java.io.Reader r, java.nio.charset.Charset cs)
          Create a wire format parser.
 WireFormatParser createParser(InputProperties inProps, XmlEventSource source)
          Create a wire format parser for a given xml event source.
 java.lang.String getName()
          Returns the wire format name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML

public static final XmlWireFormat XML
XML wire format.


ALL

public static final java.util.List<WireFormat> ALL
List of all supported wire formats.


name

protected final java.lang.String name
Logical name for the wire format.

Constructor Detail

WireFormat

protected WireFormat(java.lang.String name)
Constructs a new wire format with the specific logical name.

Parameters:
name - wire format name.
Method Detail

getName

public java.lang.String getName()
Returns the wire format name.

Returns:
logical name of wire format.

createGenerator

public abstract WireFormatGenerator createGenerator(OutputProperties outProps,
                                                    java.io.Writer w,
                                                    java.nio.charset.Charset cs,
                                                    boolean prettyPrint)
Create a wire format generator.

Parameters:
outProps - the output properties to use for output
w - writer where output is sent to
cs - character set used to encode output
prettyPrint - true if output should be in prettyprint format
Returns:
wire format generator

createParser

public abstract WireFormatParser createParser(InputProperties inProps,
                                              java.io.Reader r,
                                              java.nio.charset.Charset cs)
Create a wire format parser.

Parameters:
inProps - the input properties to use when parsing
r - reader where input is retrieved from
cs - character set used to encode output
Returns:
wire format parser

createParser

public WireFormatParser createParser(InputProperties inProps,
                                     XmlEventSource source)
Create a wire format parser for a given xml event source. By default this throws UnsupportedOperationException, subclasses can implement this if they choose to.