com.davisor.data.stream
Class ProxyDataBuffer.ProxyDataStream

java.lang.Object
  extended bycom.davisor.data.stream.ProxyDataBuffer.ProxyDataStream
All Implemented Interfaces:
Data, DataStream
Enclosing class:
ProxyDataBuffer

public class ProxyDataBuffer.ProxyDataStream
extends java.lang.Object
implements DataStream

ProxyDataStream implements a single column view to a multi column stream.


Field Summary
protected  DataStream M_dataStream
          The data stream this proxy refers to.
protected  boolean M_reversed
          Controls if stream reads buffer forwards or backwards.
 
Fields inherited from interface com.davisor.data.stream.DataStream
INITIAL_INDEX
 
Constructor Summary
ProxyDataBuffer.ProxyDataStream(boolean reversed)
          Creates a new proxy data stream.
ProxyDataBuffer.ProxyDataStream(boolean reversed, long index)
          Creates a new proxy data stream that starts reading data from given stream position.
 
Method Summary
 boolean close()
          Dummy implementation for buffer case.
 long getIndex()
          Retrieves the index number of the element returned by the latest next() call.
 java.lang.Object getMetaData()
          Deprecated. replaced with Type.getMetaData()
 Type getType()
          Gets the type of this data object.
 boolean hasNext()
          Tests if the stream still contains data.
 DataValue next()
          Gets the next data from the stream.
 void setMetaData(java.lang.Object metaData)
          Deprecated. replaced with Type.setMetaData(Map)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M_dataStream

protected DataStream M_dataStream
The data stream this proxy refers to.


M_reversed

protected boolean M_reversed
Controls if stream reads buffer forwards or backwards.

Constructor Detail

ProxyDataBuffer.ProxyDataStream

public ProxyDataBuffer.ProxyDataStream(boolean reversed)
                                throws InvalidDataException
Creates a new proxy data stream.

Parameters:
reversed - controls if stream reads buffer forwards or backwards
Throws:
java.lang.NullPointerException - if the source buffer is null
InvalidDataException

ProxyDataBuffer.ProxyDataStream

public ProxyDataBuffer.ProxyDataStream(boolean reversed,
                                       long index)
                                throws InvalidDataException
Creates a new proxy data stream that starts reading data from given stream position.

Parameters:
reversed - controls if stream reads buffer forwards or backwards
index - number of elements to skip from the head of the stream
Throws:
java.lang.NullPointerException - if the source buffer is null
InvalidDataException
Method Detail

close

public boolean close()
Dummy implementation for buffer case.

Specified by:
close in interface DataStream
Returns:
if stream closing was successfull or not
See Also:
DataStream.hasNext()

getType

public Type getType()
             throws InvalidDataException
Gets the type of this data object.

Specified by:
getType in interface Data
Returns:
the type associated with this data object
Throws:
java.lang.ClassCastException - if a target type could not be resolved
InvalidDataException - if type retrieval fails
java.lang.NullPointerException - if the source buffer is null

getIndex

public long getIndex()
Retrieves the index number of the element returned by the latest next() call. The index represents the position of the element within this stream. The stream index may or may not be equal to any other indexes the element itself thinks it posesses.

The index value is initially -1, indicating no element. After first next() call, index becomes 0, then 1, and so on. This functionality resembles java.sql.resultSet#getRow method functionality, but with the difference that the index counter starts from 0, not 1.

Specified by:
getIndex in interface DataStream
Returns:
element index
Throws:
java.lang.NullPointerException - if the source buffer is null

getMetaData

public java.lang.Object getMetaData()
Deprecated. replaced with Type.getMetaData()

Gets the data stream meta data.

This method does nothing as it would be impossible to implement because the underlying and now deprecated meta data mechanism does not allow meta data to be assosiated to any particular stream column.

Returns:
always null

hasNext

public boolean hasNext()
Tests if the stream still contains data.

Specified by:
hasNext in interface DataStream
Returns:
true if it does.
Throws:
java.lang.NullPointerException - if the source buffer is null

next

public DataValue next()
               throws InvalidDataException
Gets the next data from the stream.

Specified by:
next in interface DataStream
Throws:
InvalidDataException - if no data element could be retrieved
java.lang.NullPointerException - if the source buffer is null

setMetaData

public void setMetaData(java.lang.Object metaData)
Deprecated. replaced with Type.setMetaData(Map)

Sets the data stream meta data.

This method does nothing as it would be impossible to implement because the underlying and now deprecated meta data mechanism does not allow meta data to be assosiated to any particular column.

Parameters:
metaData - an application spesific meta data object


Copyright © 2001-2004 Davisor Oy. All Rights Reserved.