Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

Core::IOAccessor Class Reference

#include <IOAccessor.h>

Inheritance diagram for Core::IOAccessor:

Inheritance graph
[legend]
Collaboration diagram for Core::IOAccessor:

Collaboration graph
[legend]
List of all members.

Public Member Functions

virtual String * className (void) const
 Answer receiver class name.
virtual void close (void) abstract
virtual long bufferSize (void)
virtual void commit (void)
virtual long dataSize (void)
virtual LineEndConvention lineEndConvention (void)
virtual int readInto (ByteArray *buffer)
virtual int readInto (ByteArray *buffer, long startIndex, long count) abstract
virtual int writeFrom (ByteArray *buffer)
virtual int writeFrom (ByteArray *buffer, long startIndex, long count) abstract
virtual int writeForSureFrom (ByteArray *buffer, long startIndex, long count)
virtual void seekTo (long position) abstract
virtual void readWait (void)
virtual void writeWait (void)
virtual ExternalReadStream * readStream (void)
virtual ExternalReadAppendStream * readAppendStream (void)
virtual ExternalWriteStream * writeStream (void)
virtual ExternalEncodedStreamFactory * withEncoding (String *encoding)
virtual ExternalEncodedStreamFactory * withEncoding (const char *encoding)
virtual void changeDescriptorTo (int fd)
 Duplicates file descriptor to given number and then closes original one.
virtual bool isSeekable (void)

Member Function Documentation

long IOAccessor::bufferSize (  void   )  [virtual]
 

Reimplemented in Net::SocketAccessor, and OS::MessageQueue.

Definition at line 41 of file IOAccessor.cc.

Referenced by Core::IOBuffer::IOBuffer(), and Tools::Filename::privateCopy().

00042 {
00043     return 4096;
00044 }

void IOAccessor::changeDescriptorTo (  int  fd  )  [virtual]
 

Duplicates file descriptor to given number and then closes original one.

In fact it calls dup2 and close functions. Use with caution.

Reimplemented in Core::FileAccessor.

Definition at line 124 of file IOAccessor.cc.

References Core::Object::shouldNotImplement().

00125 {
00126     shouldNotImplement(__PRETTY_FUNCTION__);
00127 }

String * IOAccessor::className (  void   )  const [virtual]
 

Answer receiver class name.

Because there isn't any standard way to obtain class name this method comes to place.

Every class should rewrite this method but many didn't (yet).

Reimplemented from Core::Object.

Reimplemented in Core::FileAccessor, Net::SocketAccessor, and OS::UnixPipe.

Definition at line 35 of file IOAccessor.cc.

00036 {
00037     return new String("IOAccessor");
00038 }

virtual void Core::IOAccessor::close (  void   )  [virtual]
 

Reimplemented in Core::FileAccessor, Net::SocketAccessor, OS::MessageQueue, and OS::UnixPipe.

Referenced by Core::ExternalWriteStream::closeConnection(), and Core::ExternalStream::closeConnection().

void IOAccessor::commit (  void   )  [virtual]
 

Reimplemented in Core::FileAccessor.

Definition at line 46 of file IOAccessor.cc.

Referenced by Core::IOBuffer::commit().

00047 {
00048     /* Does nothing */
00049 }

long IOAccessor::dataSize (  void   )  [virtual]
 

Reimplemented in Core::FileAccessor.

Definition at line 51 of file IOAccessor.cc.

Referenced by Core::ExternalStream::contents(), Core::ExternalWriteStream::size(), and Core::ExternalWriteStream::writePosition().

00052 {
00053     return 0;
00054 }

bool IOAccessor::isSeekable (  void   )  [virtual]
 

Reimplemented in Core::FileAccessor.

Definition at line 130 of file IOAccessor.cc.

Referenced by Core::IOBuffer::isSeekable().

00131 {
00132     return false;
00133 }

LineEndConvention IOAccessor::lineEndConvention (  void   )  [virtual]
 

Reimplemented in Core::FileAccessor.

Definition at line 56 of file IOAccessor.cc.

References Core::LineEndTransparent.

00057 {
00058     return LineEndTransparent;
00059 }

ExternalReadAppendStream * IOAccessor::readAppendStream (  void   )  [virtual]
 

Definition at line 103 of file IOAccessor.cc.

Referenced by Tools::Filename::readAppendStream(), and Core::ExternalEncodedStreamFactory::readAppendStream().

00104 {
00105     return new ExternalReadAppendStream(this);
00106 }

virtual int Core::IOAccessor::readInto (  ByteArray *  buffer,
long  startIndex,
long  count
)  [virtual]
 

Reimplemented in Core::FileAccessor, Net::SocketAccessor, OS::MessageQueue, and OS::UnixPipe.

int IOAccessor::readInto (  ByteArray *  buffer  )  [virtual]
 

Reimplemented in Core::FileAccessor, Net::SocketAccessor, and OS::UnixPipe.

Definition at line 62 of file IOAccessor.cc.

References Core::ByteArray::size().

Referenced by Core::IOBuffer::readBufferStartingAt(), and Core::FileAccessor::readInto().

00063 {
00064     return readInto(buffer, 0, buffer->size());
00065 }

ExternalReadStream * IOAccessor::readStream (  void   )  [virtual]
 

Reimplemented in OS::UnixPipe.

Definition at line 98 of file IOAccessor.cc.

Referenced by OS::UnixPipe::readStream(), and Core::ExternalEncodedStreamFactory::readStream().

00099 {
00100     return new ExternalReadStream(this);
00101 }

void IOAccessor::readWait (  void   )  [virtual]
 

Reimplemented in Net::SocketAccessor.

Definition at line 87 of file IOAccessor.cc.

00088 {
00089     /* Does nothing */
00090 }

virtual void Core::IOAccessor::seekTo (  long  position  )  [virtual]
 

Reimplemented in Core::FileAccessor, Net::SocketAccessor, OS::MessageQueue, and OS::UnixPipe.

Referenced by Core::IOBuffer::readPositionAndSetOffset().

ExternalEncodedStreamFactory * IOAccessor::withEncoding (  const char *  encoding  )  [virtual]
 

Definition at line 118 of file IOAccessor.cc.

References withEncoding().

00119 {
00120     return withEncoding(new String(encoding));
00121 }

ExternalEncodedStreamFactory * IOAccessor::withEncoding (  String *  encoding  )  [virtual]
 

Definition at line 113 of file IOAccessor.cc.

Referenced by Core::ByteCharacterEncoder::loadFromFile(), and withEncoding().

00114 {
00115     return new ExternalEncodedStreamFactory(this, encoding);
00116 }

int IOAccessor::writeForSureFrom (  ByteArray *  buffer,
long  startIndex,
long  count
)  [virtual]
 

Definition at line 72 of file IOAccessor.cc.

References writeFrom().

Referenced by Core::IOBuffer::flushBufferUpTo().

00073 {
00074     long start = startIndex;
00075     long total = 0;
00076     long result;
00077 
00078     while (total < count) {
00079         result = writeFrom(buffer, start, count - total);
00080         start += result;
00081         total += result;
00082     }
00083     return total;
00084 }

virtual int Core::IOAccessor::writeFrom (  ByteArray *  buffer,
long  startIndex,
long  count
)  [virtual]
 

Reimplemented in Core::FileAccessor, Net::SocketAccessor, OS::MessageQueue, and OS::UnixPipe.

int IOAccessor::writeFrom (  ByteArray *  buffer  )  [virtual]
 

Reimplemented in Core::FileAccessor, Net::SocketAccessor, and OS::UnixPipe.

Definition at line 67 of file IOAccessor.cc.

References Core::ByteArray::size().

Referenced by writeForSureFrom(), and Core::FileAccessor::writeFrom().

00068 {
00069     return writeFrom(buffer, 0, buffer->size());
00070 }

ExternalWriteStream * IOAccessor::writeStream (  void   )  [virtual]
 

Reimplemented in OS::UnixPipe.

Definition at line 108 of file IOAccessor.cc.

Referenced by Tools::Filename::appendStream(), OS::UnixPipe::writeStream(), and Core::ExternalEncodedStreamFactory::writeStream().

00109 {
00110     return new ExternalWriteStream(this);
00111 }

void IOAccessor::writeWait (  void   )  [virtual]
 

Reimplemented in Net::SocketAccessor.

Definition at line 92 of file IOAccessor.cc.

00093 {
00094     /* Does nothing */
00095 }


The documentation for this class was generated from the following files:
Generated on Mon Nov 27 09:51:37 2006 for Smalltalk like C++ Class Library by  doxygen 1.4.2