com.davisor.data.stream
Class SimpleDataBuffer

java.lang.Object
  extended bycom.davisor.data.stream.SimpleDataBuffer
All Implemented Interfaces:
Data, DataBuffer, DataSource

public class SimpleDataBuffer
extends java.lang.Object
implements DataBuffer

SimpleDataBuffer is a DataBuffer implementation for single DataValues.

Since:
JDK1.2
See Also:
Type

Field Summary
protected  DataValue value
          The data value.
 
Constructor Summary
SimpleDataBuffer(DataValue value)
          Constructs a new SimpleDataBuffer from the given DataValue.
 
Method Summary
 boolean close()
          Dummy implementation for data buffer case.
 boolean equals(java.lang.Object o)
          Tests if given object equals to this.
 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.
 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.
 void setData(DataValue value)
           
 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

value

protected DataValue value
The data value.

Constructor Detail

SimpleDataBuffer

public SimpleDataBuffer(DataValue value)
Constructs a new SimpleDataBuffer from the given DataValue.

Method Detail

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

getData

public 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 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

close

public boolean close()
Dummy implementation for data buffer case.

Specified by:
close in interface DataSource
Returns:
true

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 calues.

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.


setData

public void setData(DataValue value)


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