#include <Utilities/StorageFactory/interface/IOOutput.h>
Public Member Functions | |
virtual IOSize | write (const void *from, IOSize n)=0 |
Write n bytes of data starting at address from. | |
IOSize | write (IOBuffer from) |
Write to the output stream the buffer from. | |
IOSize | write (unsigned char byte) |
Write a single byte to the output stream. | |
virtual IOSize | writev (const IOBuffer *from, IOSize buffers) |
Write to the output stream from multiple buffers. | |
IOSize | xwrite (IOBuffer from) |
Like the corresponding write() method but writes until the requested number of bytes are written. | |
IOSize | xwrite (const void *from, IOSize n) |
Like the corresponding write() method but writes until the requested number of bytes are written. | |
IOSize | xwritev (const IOBuffer *from, IOSize buffers) |
Like the corresponding writev() method but writes until the requested number of bytes are written. | |
virtual | ~IOOutput (void) |
Destruct the stream. A no-op. |
Definition at line 7 of file IOOutput.h.
IOOutput::~IOOutput | ( | void | ) | [virtual] |
Write n bytes of data starting at address from.
In | case of error, an exception is thrown. However if the stream is in non-blocking mode and cannot accept output, it will not throw an exception -- the return value will be less than requested. |
Implemented in DCacheFile, RFIOFile, File, IOChannel, LocalCacheFile, StorageAccountProxy, and XrdFile.
Write to the output stream the buffer from.
This method is simply redirected to write(const void *, IOSize).
Note that derived classes should not normally call this method, as it simply routes the call back to derived class through the other virtual functions. Use this method only at the "outside edge" when transferring calls from one object to another, not in up/down calls in the inheritance tree.
In | case of error, an exception is thrown. However if the stream is in non-blocking mode and cannot accept output, it will not throw an exception -- the return value will be less than requested. |
Definition at line 63 of file IOOutput.cc.
References IOBuffer::data(), IOBuffer::size(), and write().
IOSize IOOutput::write | ( | unsigned char | byte | ) |
Write a single byte to the output stream.
This method is simply redirected to write(const void *, IOSize).
Note that derived classes should not normally call this method, as it simply routes the call back to derived class through the other virtual functions. Use this method only at the "outside edge" when transferring calls from one object to another, not in up/down calls in the inheritance tree.
In | case of error, an exception is thrown. However if the stream is in non-blocking mode and cannot accept output, it will not throw an exception -- zero will be returned. |
Definition at line 41 of file IOOutput.cc.
Referenced by write(), writev(), and xwrite().
Write to the output stream from multiple buffers.
There are buffers to fill in an array starting at from. The buffers are filled in the order given, each buffer fully before the subsequent buffers. The method uses write(const void *, IOSize), but may be implemented more efficiently in derived classes.
Note that derived classes should not normally call this method, as it simply routes the call back to derived class through the other virtual functions. Use this method only at the "outside edge" when transferring calls from one object to another, not in up/down calls in the inheritance tree.
In | case of error, an exception is thrown. However if the stream is in non-blocking mode and cannot accept output, it will not throw an exception -- the return value will be less than requested. |
Reimplemented in File, IOChannel, LocalCacheFile, and StorageAccountProxy.
Definition at line 90 of file IOOutput.cc.
References data, i, size, write(), and x.
00091 { 00092 assert (! buffers || from); 00093 00094 // Keep writing as long as possible; ignore errors if we have 00095 // written something, otherwise pass it on. 00096 IOSize x; 00097 IOSize done = 0; 00098 try 00099 { 00100 for (IOSize i = 0; i < buffers; ++i) 00101 { 00102 done += (x = write (from [i].data (), from [i].size ())); 00103 if (x < from [i].size ()) 00104 break; 00105 } 00106 } 00107 catch (cms::Exception &) 00108 { 00109 if (! done) 00110 throw; 00111 } 00112 00113 return done; 00114 }
Like the corresponding write() method but writes until the requested number of bytes are written.
Writes from contents. This method is redirected to xwrite(const void *, IOSize).
Unlike write() which may write less data than requested, this function attempts to write, possibly in multiple write() calls, the exact requested amount of data. It stops writing only in case of error.
If you know the stream blocks on write() and it would be inconvenient to handle partial write(), use this method as a convenience for hiding platforms and circumstance differences. It makes no sense to use this method with non-blocking output.
Note that derived classes should not normally call this method, as it simply routes the call back to derived class through the other virtual functions. Use this method only at the "outside edge" when transferring calls from one object to another, not in up/down calls in the inheritance tree.
All | exceptions from write() are passed through unhandled. Therefore it is possible that an exception is thrown when this function has already written some data. |
Definition at line 146 of file IOOutput.cc.
References IOBuffer::data(), IOBuffer::size(), and xwrite().
Like the corresponding write() method but writes until the requested number of bytes are written.
Writes data from the buffer from for its full size.
Unlike write() which may write less data than requested, this function attempts to write, possibly in multiple write() calls, the exact requested amount of data. It stops writing only in case of error.
If you know the stream blocks on write() and it would be inconvenient to handle partial write(), use this method as a convenience for hiding platforms and circumstance differences. It makes no sense to use this method with non-blocking output.
Note that derived classes should not normally call this method, as it simply routes the call back to derived class through the other virtual functions. Use this method only at the "outside edge" when transferring calls from one object to another, not in up/down calls in the inheritance tree.
All | exceptions from write() are passed through unhandled. Therefore it is possible that an exception is thrown when this function has already written some data. |
Definition at line 176 of file IOOutput.cc.
References write().
Referenced by TStorageFactoryFile::WriteBuffer(), xwrite(), and xwritev().
00177 { 00178 // Keep writing until we've written it all. Let errors fly over. 00179 IOSize done = 0; 00180 while (done < n) 00181 done += write ((const char *) from + done, n - done); 00182 00183 return done; 00184 }
Like the corresponding writev() method but writes until the requested number of bytes are written.
Writes data from buffers starting at from, each for its full size. The buffers are filled in the order given. This method uses xwrite(const void *, IOSize).
Unlike write() which may write less data than requested, this function attempts to write, possibly in multiple write() calls, the exact requested amount of data. It stops writing only in case of error.
If you know the stream blocks on write() and it would be inconvenient to handle partial write(), use this method as a convenience for hiding platforms and circumstance differences. It makes no sense to use this method with non-blocking output.
Note that derived classes should not normally call this method, as it simply routes the call back to derived class through the other virtual functions. Use this method only at the "outside edge" when transferring calls from one object to another, not in up/down calls in the inheritance tree.
All | exceptions from write() are passed through unhandled. Therefore it is possible that an exception is thrown when this function has already written some data. |
Definition at line 215 of file IOOutput.cc.
References data, i, size, and xwrite().
00216 { 00217 // Keep writing until we've written it all. Let errors fly over. 00218 // FIXME: Use writev(from, buffers) and then sort out in case of 00219 // failure, the writev probably succeed directly with much less 00220 // overhead. 00221 assert (! buffers || from); 00222 00223 IOSize done = 0; 00224 for (IOSize i = 0; i < buffers; ++i) 00225 done += xwrite (from [i].data (), from [i].size ()); 00226 00227 return done; 00228 }