com.davisor.data.stream
Class IndirectDataBuffer

java.lang.Object
  extended bycom.davisor.data.stream.IndirectDataBuffer
All Implemented Interfaces:
Data, DataBuffer, DataSource
Direct Known Subclasses:
ProxyDataBuffer, ReversedDataBuffer

public abstract class IndirectDataBuffer
extends java.lang.Object
implements DataBuffer

IndirectDataBuffer is an abstract base class for DataBuffers which are implemented on top of other DataBuffers. This class provides default implementations for most of the DataBuffer interface methods based on the underlying DataBuffer implementation, but at least methods getData(int) and getStream(boolean) must be implemented in sub classes.

Since:
JDK1.2
See Also:
getData(int), getStream(boolean), Type

Field Summary
protected  DataBuffer M_dataBuffer
          The data buffer.
 
Constructor Summary
protected IndirectDataBuffer(DataBuffer dataBuffer)
          Constructs a new IndirectDataBuffer from the given DataBuffer.
 
Method Summary
 boolean close()
          Closing of data buffers is usually not so important, than to close importing data sources.
 boolean equals(java.lang.Object o)
          Tests if given object equals to this.
abstract  DataValue getData(int index)
          Gets the specific data element from the data buffer.
 int getSize()
          Gets the number of data elements in the data buffer.
 DataStream getStream()
          Gets a new data stream from the data source.
abstract  DataStream getStream(boolean reversed)
          Gets a new data stream from the data source.
 Type getType()
          Gets the type of this data object.
 int hashCode()
          Returns the hash code of the underlying DataValue.
 java.lang.String toString()
          Returns the string representation of this data buffer.
 java.lang.String toString(java.lang.String id, java.lang.String dataName)
          Returns a String representation of the DataSource.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

M_dataBuffer

protected DataBuffer M_dataBuffer
The data buffer.

Constructor Detail

IndirectDataBuffer

protected IndirectDataBuffer(DataBuffer dataBuffer)
Constructs a new IndirectDataBuffer from the given DataBuffer.

Method Detail

close

public boolean close()
Closing of data buffers is usually not so important, than to close importing data sources. Therefore, a stub implementaion for close is provided in this abstract class.

Specified by:
close in interface DataSource
Returns:
a false boolean may be returned, if closing data source was a failure.

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:
InvalidDataException - if type retrieval fails
See Also:
Data.getType()

getData

public abstract DataValue getData(int index)
                           throws com.davisor.core.InvalidIndexException
Gets the specific data element from the data buffer.

Specified by:
getData in interface DataBuffer
Parameters:
index - data element index
Throws:
com.davisor.core.InvalidIndexException - if no data is bound to given index

getSize

public int getSize()
Gets the number of data elements in the data buffer.

Specified by:
getSize in interface DataBuffer

getStream

public abstract DataStream getStream(boolean reversed)
                              throws InvalidDataException
Gets a new data stream from the data source.

Specified by:
getStream in interface DataBuffer
Parameters:
reversed - controls if stream reads buffer forwards or backwards
Throws:
InvalidDataException - if a new stream can not be created

getStream

public DataStream getStream()
                     throws InvalidDataException
Gets a new data stream from the data source.

Specified by:
getStream in interface DataSource
Throws:
InvalidDataException

toString

public java.lang.String toString(java.lang.String id,
                                 java.lang.String dataName)
Returns a String representation of the DataSource. The possible id and dataname are is overridden with the given values.

Specified by:
toString in interface DataSource

equals

public boolean equals(java.lang.Object o)
Tests if given object equals to this.


hashCode

public int hashCode()
Returns the hash code of the underlying DataValue.


toString

public java.lang.String toString()
Returns the string representation of this data buffer.



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