This snippet illustrates how to use piped io stream. Implementation of piped I/O stream based on slices of byte arrays. This implementation able to put ByteArray's and reading ByteArray's with the different lens. Block size per slice can be specified in the constructor when creation instance.
// Creation a byte buffer with initial capacity 1024 bytes
auxutils::io::ByteBuffer* poBuffer = new auxutils::io::ByteBuffer( 1024 );
// Appending a C-style buffer
const unsigned char cStyleBuffer[] = { 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F };
poBuffer->append (cStyleBuffer, sizeof ( cStyleBuffer ) );
// Creating stream
auxutils::io::ByteArrayInputOutputStream* poStream = new auxutils::io::ByteArrayInputOutputStream();
// Write some data
poStream->write( poBuffer );
// Read data into specified buffer
auxutils::io::ByteBuffer* poOutBuffer = new auxutils::io::ByteBuffer( 512 );
poStream->read ( poOutBuffer );
// Delete objects
delete poBuffer;
delete poStream;