org.fudgemsg.mapping
Class FudgeObjectReader

java.lang.Object
  extended by org.fudgemsg.mapping.FudgeObjectReader

public class FudgeObjectReader
extends Object

Deserialises Java objects from an underlying stream of Fudge messages.


Constructor Summary
FudgeObjectReader(FudgeMsgReader messageReader)
          Creates a new FudgeObjectReader around the underlying FudgeMsgReader stream.
 
Method Summary
 void close()
          Closes the underlying stream.
 FudgeDeserializationContext getDeserialisationContext()
          Returns the current FudgeDeserializationContext.
 FudgeContext getFudgeContext()
          Returns the underlying FudgeContext.
 FudgeMsgReader getMessageReader()
          Returns the underlying message source.
 boolean hasNext()
          Returns true if the underlying message source has another message and read() or read(Class) can be called.
 Object read()
          Reads the next message from the underlying source and deserializes it to a Java object.
<T> T
read(Class<T> clazz)
          Reads the next message from the underlying source and deserializes it to the requested Java type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FudgeObjectReader

public FudgeObjectReader(FudgeMsgReader messageReader)
Creates a new FudgeObjectReader around the underlying FudgeMsgReader stream.

Parameters:
messageReader - the source of Fudge messages containing serialised objects
Method Detail

close

public void close()
Closes the underlying stream.


getFudgeContext

public FudgeContext getFudgeContext()
Returns the underlying FudgeContext. This will be the context of the FudgeMsgReader being used.

Returns:
the FudgeContext

getDeserialisationContext

public FudgeDeserializationContext getDeserialisationContext()
Returns the current FudgeDeserializationContext. This is associated with the same FudgeContext as the source message stream.

Returns:
the FudgeDeserialisationContext

getMessageReader

public FudgeMsgReader getMessageReader()
Returns the underlying message source.

Returns:
the FudgeMsgReader

hasNext

public boolean hasNext()
Returns true if the underlying message source has another message and read() or read(Class) can be called.

Returns:
true if there are more messages to be deserialized, false otherwise

read

public Object read()
Reads the next message from the underlying source and deserializes it to a Java object.

Returns:
the Java object

read

public <T> T read(Class<T> clazz)
Reads the next message from the underlying source and deserializes it to the requested Java type.

Type Parameters:
T - Java type of the requested object
Parameters:
clazz - Java class of the requested object
Returns:
the Java object


Copyright 2009-Present by OpenGamma Inc. and individual contributors
Released under the Apache License, Version 2.0