net.sf.jsefa.rbf
Class RbfDeserializerImpl

java.lang.Object
  extended by net.sf.jsefa.rbf.RbfDeserializerImpl
All Implemented Interfaces:
Deserializer, RbfDeserializer
Direct Known Subclasses:
CsvDeserializerImpl, FlrDeserializerImpl

public abstract class RbfDeserializerImpl
extends Object
implements RbfDeserializer

Abstract implementation of RbfDeserializer for RBF types.

Author:
Norman Lahme-Huetig

Constructor Summary
protected RbfDeserializerImpl(RbfConfiguration<?> config, Map<String,RbfEntryPoint> entryPointsByPrefixes)
          Constructs a new AbstractRbfDeserializer.
protected RbfDeserializerImpl(RbfConfiguration<?> config, RbfEntryPoint entryPoint)
          Constructs a new AbstractRbfDeserializer.
 
Method Summary
 void close(boolean closeReader)
          Closes the deserialization stream.
 InputPosition getInputPosition()
          Returns information about the current position within the input stream.
protected abstract  RbfLowLevelDeserializer getLowLevelDeserializer()
          Returns the low level deserializer.
 List<Line> getStoredLines()
          Returns a list of lines stored during deserialization.
 boolean hasNext()
          Returns true if another object can be deserialized from the stream.
<T> T
next()
          Deserializes an object from the stream.
 void open(Reader reader)
          Opens a new deserialization stream based on the given reader.
protected abstract  String readPrefix()
          Reads the prefix of the current record from the stream.
protected abstract  Object readSimpleValue(SimpleTypeMapping<?> typeMapping)
          Reads a simple value from the stream using the given type mapping.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RbfDeserializerImpl

protected RbfDeserializerImpl(RbfConfiguration<?> config,
                              Map<String,RbfEntryPoint> entryPointsByPrefixes)
Constructs a new AbstractRbfDeserializer.

Parameters:
config - the configuration
entryPointsByPrefixes - a map which maps prefixes to entry points

RbfDeserializerImpl

protected RbfDeserializerImpl(RbfConfiguration<?> config,
                              RbfEntryPoint entryPoint)
Constructs a new AbstractRbfDeserializer.

Parameters:
config - the configuration
entryPoint - the entry point
Method Detail

open

public final void open(Reader reader)
Opens a new deserialization stream based on the given reader.

Specified by:
open in interface Deserializer
Parameters:
reader - the reader to base the stream on.

hasNext

public final boolean hasNext()
Returns true if another object can be deserialized from the stream.

Specified by:
hasNext in interface Deserializer
Returns:
true, if another object can be deserialized from the stream, otherwise false.

next

public final <T> T next()
Deserializes an object from the stream.

Specified by:
next in interface Deserializer
Type Parameters:
T - the expected type of the object
Returns:
the deserialized object.

close

public final void close(boolean closeReader)
Closes the deserialization stream. The underlying reader will be closed only if closeReader is true.

Specified by:
close in interface Deserializer
Parameters:
closeReader - if true, the underlying reader will be closed, too.

getInputPosition

public final InputPosition getInputPosition()
Returns information about the current position within the input stream.

Specified by:
getInputPosition in interface Deserializer
Returns:
the input position or null if no position information is available

getStoredLines

public List<Line> getStoredLines()
Returns a list of lines stored during deserialization.

Specified by:
getStoredLines in interface RbfDeserializer
Returns:
a list of lines
See Also:
LineFilter

readSimpleValue

protected abstract Object readSimpleValue(SimpleTypeMapping<?> typeMapping)
Reads a simple value from the stream using the given type mapping.

Parameters:
typeMapping - the type mapping
Returns:
a simple value

readPrefix

protected abstract String readPrefix()
Reads the prefix of the current record from the stream.

Returns:
a prefix

getLowLevelDeserializer

protected abstract RbfLowLevelDeserializer getLowLevelDeserializer()
Returns the low level deserializer.

Returns:
the low level deserializer.


Copyright © 2014. All rights reserved.