I changed _in->setStream( new std::stringstream(data) ); to _dataDecompress = new std::stringstream(data); _in->setStream( _dataDecompress ); Then when the destructor is of InputStream is called I delete the dataDecompress stringstream. "