com.google.gdata.wireformats.input
Class CharacterParser<T>

java.lang.Object
  extended by com.google.gdata.wireformats.input.AbstractParser<T>
      extended by com.google.gdata.wireformats.input.CharacterParser<T>
All Implemented Interfaces:
InputParser<T>
Direct Known Subclasses:
ElementParser, XmlInputParser

public abstract class CharacterParser<T>
extends AbstractParser<T>

The CharacterParser class is abstract base class to support the implementation of an InputParser for character-based content types.

It encapsulates the code for mapping from an InputStream to an Reader based upon the input content type and then delegates to the abstract parse(Reader, InputProperties, Class) method to handle the actual parsing of the character data.


Method Summary
<R extends T>
R
parse(ParseSource parseSource, InputProperties inProps, java.lang.Class<R> targetClass)
          The parse method will use the character encoding found in the output properties instance to construct an appropriate Reader and then delegate to the parse(Reader, InputProperties, Class) method to perform the parsing.
abstract
<R extends T>
R
parse(java.io.Reader inputReader, InputProperties inProps, java.lang.Class<R> resultClass)
          Parses character content with the specified properties to produce a result of an expected type.
 
Methods inherited from class com.google.gdata.wireformats.input.AbstractParser
getAltFormat, getResultType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

parse

public <R extends T> R parse(ParseSource parseSource,
                             InputProperties inProps,
                             java.lang.Class<R> targetClass)
                  throws java.io.IOException,
                         ServiceException
The parse method will use the character encoding found in the output properties instance to construct an appropriate Reader and then delegate to the parse(Reader, InputProperties, Class) method to perform the parsing.

Parameters:
parseSource - providing the source of the data
inProps - properties describing the input data
targetClass - specific type of result expected from the parse
Throws:
java.io.IOException
ServiceException

parse

public abstract <R extends T> R parse(java.io.Reader inputReader,
                                      InputProperties inProps,
                                      java.lang.Class<R> resultClass)
                           throws java.io.IOException,
                                  ServiceException
Parses character content with the specified properties to produce a result of an expected type. Concrete subclasses will provide an implementation of this method that constructs a result type instance of the result class and then parses into it from the provided Reader.

Type Parameters:
R - expected result type
Parameters:
inputReader - reader to parse data from
inProps - input properties
resultClass - class to instantiate and parse result into.
Returns:
result object from parse
Throws:
java.io.IOException - if an error occurred reading data while parsing
ServiceException - if an error occurred within the content