spark.data.io
Interface SparkReader

All Known Implementing Classes:
JSONReader, SONReader

public interface SparkReader

This defines the interface for classes that can read Spark objects from some external form.

Author:
olsen

Method Summary
 TypeFactory getTypeFactory()
          This will return the TypeFactory being used.
 SV read()
          This is the heart of the reader.
 void setSource(java.io.InputStream source)
          This will set the source from which objects are to be read.
 void setSource(java.lang.String source)
          This will set a string from which objects can be read.
 void setTypeFactory(TypeFactory factory)
          This will set the TypeFactory to be used in constructing objects based on what is read from the external form.
 

Method Detail

setTypeFactory

void setTypeFactory(TypeFactory factory)
This will set the TypeFactory to be used in constructing objects based on what is read from the external form.

Parameters:
factory - the factory to be used in translating type names into objects

getTypeFactory

TypeFactory getTypeFactory()
This will return the TypeFactory being used.

Returns:
a TypeFactory

setSource

void setSource(java.io.InputStream source)
This will set the source from which objects are to be read.

Parameters:
source - an input stream from which to read objects.

setSource

void setSource(java.lang.String source)
This will set a string from which objects can be read.

Parameters:
source - the source string from which objects can be read
Throws:
java.lang.RuntimeException - if a particular format cannot be read from a string. This would be true if the format was binary.

read

SV read()
This is the heart of the reader. This is where an object or any Spark value is read from the source.

Returns:
the value that was read or null if there were no values left in the source.
Throws:
java.lang.RuntimeException - if there are any syntax errors or type conversion errors.