Inherits YGP::File.
Public Member Functions | |
RemoteFile (Socket &socket) | |
RemoteFile (const RemoteFile &o) | |
virtual | ~RemoteFile () |
RemoteFile & | operator= (const RemoteFile &o) |
virtual File * | clone () const |
virtual bool | isEOF (void *file) const throw (YGP::FileError) |
virtual void * | open (const char *mode) const throw (YGP::FileError) |
virtual void | close (void *file) const throw (YGP::FileError) |
virtual int | read (void *file, char *buffer, unsigned int length) const throw (YGP::FileError) |
virtual int | write (void *file, const char *buffer, unsigned int length) const throw (YGP::FileError) |
This class offers the same functionality as its parent although the file is (or can be) actually stored on a remote computer.
This class is not really (very) useful by itself but designed to be used by a RemoteDirSearch-object.
YGP::RemoteFile::RemoteFile | ( | Socket & | socket | ) | [inline] |
Default constructor; creates an empty object (holding no file) with the socket for the communication.
YGP::RemoteFile::RemoteFile | ( | const RemoteFile & | o | ) | [inline] |
Copy constructor; with the socket for the communication.
YGP::RemoteFile::~RemoteFile | ( | ) | [virtual] |
Destructor.
File * YGP::RemoteFile::clone | ( | ) | const [virtual] |
Duplicates (clones) the object and returns a pointer to the newly created object.
Reimplemented from YGP::File.
void YGP::RemoteFile::close | ( | void * | file | ) | const throw (YGP::FileError) [virtual] |
Closes a (previously opened) file.
file | Handle of opened file |
YGP::FileError | In case of an error a textual description |
Reimplemented from YGP::File.
bool YGP::RemoteFile::isEOF | ( | void * | file | ) | const throw (YGP::FileError) [virtual] |
Checks if further data is available for reading.
file | Handle of openeded file |
Reimplemented from YGP::File.
void * YGP::RemoteFile::open | ( | const char * | mode | ) | const throw (YGP::FileError) [virtual] |
Opends the file in the specified mode.
The mode parameter can have the same values as the ANSI-C fopen-function.
mode | Mode for open the file (analogue to libc's fopen) |
YGP::FileError | In case of an error a textual description |
Reimplemented from YGP::File.
RemoteFile& YGP::RemoteFile::operator= | ( | const RemoteFile & | o | ) | [inline] |
Assignment operator; with the socket for the communication.
int YGP::RemoteFile::read | ( | void * | file, | |
char * | buffer, | |||
unsigned int | length | |||
) | const throw (YGP::FileError) [virtual] |
Reads the (next) specified number of characters from the (previously opened) file (or less, if the end of the file has been reached) into buffer.
and returns the number of actually read bytes. If an error occurres, an exception is thrown
file | Handle of openeded file | |
buffer | Buffer for data | |
length | Maximal length of buffer |
YGP::FileError | In case of an error a textual description |
Reimplemented from YGP::File.
int YGP::RemoteFile::write | ( | void * | file, | |
const char * | buffer, | |||
unsigned int | length | |||
) | const throw (YGP::FileError) [virtual] |
Writes the specified number of characters to the (previously opened) file and returns the number of actually written bytes.
If an error occurres, an exception is thrown.
file | Handle of openeded file | |
buffer | Buffer of data | |
length | Length of buffer (= bytes to write) |
YGP::FileError | In case of an error |
Reimplemented from YGP::File.