25#include <zypp-core/base/Logger.h>
26#include <zypp-core/base/ExternalDataSource.h>
27#include <zypp-core/AutoDispose.h>
32 namespace externalprogram {
55 bool success = fwrite( buffer, length, 1,
outputfile ) != 0;
67 DBG <<
"send (" << s <<
")";
68 return send( s.data(), s.length() );
77 std::ostringstream datas;
81 if ( readc == EOF )
break;
83 if ( (
char)readc == c )
break;
97 return received.second;
104 return fread( buffer, 1, length,
inputfile );
size_t receive(char *buffer, size_t length)
Read some data from the input stream.
bool send(const char *buffer, size_t length)
Send some data to the output stream.
ExternalDataSource(FILE *inputfile=0, FILE *outputfile=0)
Create a new instance.
virtual int close()
Close the input and output streams.
void setBlocking(bool mode)
Set the blocking mode of the input stream.
FILE * inputFile() const
Return the input stream.
std::string receiveUpto(char c)
Read characters into a string until delimiter c or EOF is read.
std::string receiveLine()
Read one line from the input stream.
virtual ~ExternalDataSource()
Implicitly close the connection.
BlockingMode setFILEBlocking(FILE *file, bool mode)
Enables or disabled non blocking mode on a file descriptor.
std::pair< ReceiveUpToResult, std::string > receiveUpto(FILE *file, char c, timeout_type timeout, bool failOnUnblockError)
Easy-to use interface to the ZYPP dependency resolver.
#define ZYPP_THROW(EXCPT)
Drops a logline and throws the Exception.