DexNet 4.7.0
Public Member Functions
com::sparsity::dex::gdb::TextStream Class Reference

TextStream class. More...

List of all members.

Public Member Functions

int Read (char[] dataOUT, int length)
 Read data from the stream.
bool IsNull ()
 Returns if the stream is ready for reading or writing data.
void Write (char[] dataIN, int length)
 Write data to the stream.
void SetSession (com.sparsity.dex.gdb.Session s)
 TextStream (bool append)
 Creates a new instance.
void Close ()
 Closes the stream.

Detailed Description

TextStream class.

It allows for reading and writting Text attribute values.

It is very important to close the stream once no more reading or writting operations will be performed to ensure data is successfully stored.

Use of TextStream for writing: (i) Create a TextStream instance and (ii) set a Value instance with this TextStream instance, then (iii) use this value to set the Text attribute of a node or edge instance. Once the set attribute has been done, (iii) perform as many Write operations as you need to the TextStream instance. Lastly, (iv) exeucte Close to flush and close the stream.

Use of TextStream for reading: (i) Get the text attribute of a node or edge instance and (ii) get the TextStream instance from the retrieved Value instance. Once you have the TextStream instance, you can execute Read operations to read from the stream. (iii) The end of the stream is reached when Read returns 0. Finally, (iv) execute Close to close stream resources.

A stream just can be used once, that is if you need to read or write from or to the stream more than once, it is necessary to perform the get or set the attribute for each case.

Author:
Sparsity Technologies http://www.sparsity-technologies.com

Constructor & Destructor Documentation

com::sparsity::dex::gdb::TextStream::TextStream ( bool  append)

Creates a new instance.

A TextStream only can be created by the user to write data.

Parameters:
append[in] If TRUE, the it is created in append mode to write from the end of the stream, otherwise it is created to write from the begining of the stream.

Member Function Documentation

void com::sparsity::dex::gdb::TextStream::Close ( )

Closes the stream.

Once the Stream is closed, it cannot be used again.

bool com::sparsity::dex::gdb::TextStream::IsNull ( )

Returns if the stream is ready for reading or writing data.

Returns:
TRUE if the stream is ready
int com::sparsity::dex::gdb::TextStream::Read ( char[]  dataOUT,
int  length 
)

Read data from the stream.

Parameters:
dataOUT[out] Buffer to read data to. It must be allocated by the user.
length[in] Length of the given data buffer. It must be > 0.
Returns:
Amount of read data (<= length). If 0, there is no more data to be read from the stream.
void com::sparsity::dex::gdb::TextStream::SetSession ( com.sparsity.dex.gdb.Session  s)
Parameters:
snull
void com::sparsity::dex::gdb::TextStream::Write ( char[]  dataIN,
int  length 
)

Write data to the stream.

Parameters:
dataIN[in] Buffer to write data from.
length[in] Length of the data buffer. It must be > 0.