Vault
4.1
|
00001 /* 00002 Copyright c1997-2014 Trygve Isaacson. All rights reserved. 00003 This file is part of the Code Vault version 4.1 00004 http://www.bombaydigital.com/ 00005 License: MIT. See LICENSE.md in the Vault top level directory. 00006 */ 00007 00010 #include "vwritebufferedstream.h" 00011 00012 #include "vexception.h" 00013 00014 VWriteBufferedStream::VWriteBufferedStream(VStream& rawStream, Vs64 initialBufferSize, Vs64 resizeIncrement) 00015 : VMemoryStream(initialBufferSize, resizeIncrement) 00016 , mRawStream(rawStream) 00017 { 00018 } 00019 00020 Vs64 VWriteBufferedStream::read(Vu8* /*targetBuffer*/, Vs64 /*numBytesToRead*/) { 00021 throw VUnimplementedException("VWriteBufferedStream::read: Read is not permitted on buffered write stream."); 00022 } 00023 00024 void VWriteBufferedStream::flush() { 00025 // Flush the complete contents of our buffer to the raw stream. 00026 this->seek(SEEK_SET, 0); // set our i/o offset back to 0 00027 (void) VStream::streamCopy(*this, mRawStream, this->getEOFOffset()); 00028 00029 // Reset ourself to be "empty" and at i/o offset 0. 00030 this->seek(SEEK_SET, 0); 00031 this->setEOF(0); 00032 } 00033 00034 bool VWriteBufferedStream::skip(Vs64 /*numBytesToSkip*/) { 00035 throw VUnimplementedException("VWriteBufferedStream::skip: Skip is not permitted on buffered write stream."); 00036 } 00037