| 362 | } |
| 363 | |
| 364 | bool Stream::copyFrom(Stream *other) |
| 365 | { |
| 366 | U8 buffer[1024]; |
| 367 | U32 numBytes = other->getStreamSize() - other->getPosition(); |
| 368 | while((other->getStatus() != Stream::EOS) && numBytes > 0) |
| 369 | { |
| 370 | U32 numRead = numBytes > sizeof(buffer) ? sizeof(buffer) : numBytes; |
| 371 | if(! other->read(numRead, buffer)) |
| 372 | return false; |
| 373 | |
| 374 | if(! write(numRead, buffer)) |
| 375 | return false; |
| 376 | |
| 377 | numBytes -= numRead; |
| 378 | } |
| 379 | |
| 380 | return true; |
| 381 | } |
| 382 | |
| 383 | Stream* Stream::clone() const |
| 384 | { |
no test coverage detected