StreamIO.h

Classes

StreamIO -- Class for IO on connection oriented socket (full description)

class StreamIO: public ByteIO

Interface

Public Members
StreamIO(const String& hostname, uShort portNumber)
virtual ~StreamIO()
virtual void write(uInt size, const void* buf)
virtual Int read(uInt size, void* buf, Bool throwException=True)
virtual Int64 length()
virtual Bool isReadable() const
virtual Bool isWritable() const
virtual Bool isSeekable() const
Protected Members
virtual Int64 doSeek(Int64 offset, ByteIO::ByteIO)
Private Members
StreamIO (const StreamIO& other)
StreamIO& operator= (const StreamIO& other)

Description

Review Status

Date Reviewed:
yyyy/mm/dd

Prerequisite

Synopsis

This class is a specialization of class ByteIO. It uses a file descriptor to read/write data to a Internet (AF_INET) stream.

Example

Motivation

This class was needed for the online version of the VLA filler.

Member Description

StreamIO(const String& hostname, uShort portNumber)

Construct a stream that is attached to the specified host on the specified portnumber. Name lookup is not currently done so that the dotted quad notation must be used.

virtual ~StreamIO()

The destructor closes the file.

virtual void write(uInt size, const void* buf)

Write the specified number of bytes.

virtual Int read(uInt size, void* buf, Bool throwException=True)

Read size bytes from the tape. Returns the number of bytes actually read or a negative number if an error occured. Will throw an exception (AipsError) if the requested number of bytes could not be read, or an error occured, unless throwException is set to False.

virtual Int64 length()

Get the length of the stream. Not a meaningful function for this class and this function always returns -1.

virtual Bool isReadable() const

Is the stream readabale? This function always returns True.

virtual Bool isWritable() const

Is the tape device writable? This function always returns True.

virtual Bool isSeekable() const

Is the tape device seekable? This function always returns False.

virtual Int64 doSeek(Int64 offset, ByteIO::ByteIO)

Reset the position pointer to the given value. It returns the new position. As stream devices are not seekable calling this function will always throw an AipsError exception.

StreamIO (const StreamIO& other)

The following functions are made private so that the compiler does not generate default ones. They cannot be used and are not defined.

StreamIO& operator= (const StreamIO& other)