Exemple #1
0
	void	CWindowsConsoleStream::Write(CRefPtr<IStream> pInStream, const uint32 uSizeInBytes){
		try{
			Collection::CList<byte> Data(uSizeInBytes);
			pInStream->Read(Data);
			dynamic_cast<IO::IStream*>(this)->Write(Data);
		}
		catch(Exception::CException& Exception){
			throw Exception::CStreamException(
				L"Error while writing stream to console.", CR_INFO(), Exception);
		}
	}
Exemple #2
0
	void	CFileStreamWIN::Write(CRefPtr<IO::IStream> pInStream, const uint32 uSizeInBytes){
		if(!this->IsOpen()){
			throw CB::Exception::CFileStreamException(this->m_strFilename,
				L"File stream already closed.", CR_INFO());
		}

		try{
			Collection::CList<byte> Buffer(uSizeInBytes);
			Memory::SetZeroArray(Buffer);

			pInStream->Read(Buffer);
			dynamic_cast<IO::IStream*>(this)->Write(Buffer);
		}
		catch(Exception::CException& Exception){
			throw Exception::CFileStreamException(this->m_strFilename,
				L"Error while writing stream from stream.", CR_INFO(), Exception);
		}
	}