com.davisor.data.stream
Interface DataStream

All Superinterfaces:
Data
All Known Subinterfaces:
XMLDataStream
All Known Implementing Classes:
EnumeratorDataStream, IteratorDataStream, JoinedDataStream, ProxyDataBuffer.ProxyDataStream, ResultSetDataStream, TupleDataStream

public interface DataStream
extends Data

DataStream represents a stream of data elements of some specific type. The stream manifests itself as an iterator that allows the stream data to be scanned once, and once only.

Each data stream has a data type. The stream elements are expected to be of that type, although different stream implementations may enforce or ignore this constraint in various ways.

Since:
JDK1.1
See Also:
DataSource, Type

Field Summary
static long INITIAL_INDEX
          Data stream initial element index value (-1).
 
Method Summary
 boolean close()
          Explicitly closes this data stream, and frees all system resources it has allocated immediately.
 long getIndex()
          Retrieves the index number of the element returned by the latest next() call.
 boolean hasNext()
          Tests if the stream still contains data.
 DataValue next()
          Gets the next data from the stream.
 
Methods inherited from interface com.davisor.data.Data
getType
 

Field Detail

INITIAL_INDEX

public static final long INITIAL_INDEX
Data stream initial element index value (-1).

See Also:
Constant Field Values
Method Detail

close

public boolean close()
Explicitly closes this data stream, and frees all system resources it has allocated immediately. This includes in particular any large memory buffers and open network connections and files. After the stream has been closed, no new data can be read from it.

Closing data streams as early as possible is important in particular in server applications where resouces are shared between a number of threads.

Returns:
if stream closing was successfull or not
See Also:
hasNext()

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.

Returns:
element index

hasNext

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

Returns:
true if it does.

next

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

Throws:
InvalidDataException - if no data element could be retrieved


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