00001 /* Copyright (c) 2006, Gennady Bystritsky <bystr@mac.com> 00002 * 00003 * Distributed under the MIT Licence. 00004 * This is free software. See 'LICENSE' for details. 00005 * You must read and accept the license prior to use. 00006 */ 00007 00008 #ifndef _SK_IO_FILEDESCRIPTOROUTPUTSTREAM_ 00009 #define _SK_IO_FILEDESCRIPTOROUTPUTSTREAM_ 00010 00011 #include <sk/io/AbstractOutputStream.h> 00012 #include <sk/io/FileDescriptor.h> 00013 00014 namespace sk { 00015 namespace io { 00016 class FileDescriptorOutputStream 00017 : public AbstractOutputStream 00018 { 00019 public: 00020 FileDescriptorOutputStream(int fd); 00021 FileDescriptorOutputStream(const sk::io::FileDescriptor& descriptor); 00022 virtual ~FileDescriptorOutputStream(); 00023 00024 const sk::io::FileDescriptor& getFileDescriptor() const; 00025 00026 // sk::util::Object re-implementation. 00027 const sk::util::Class getClass() const; 00028 00029 // sk::io::OutputStream implementation. 00030 int write(const char* buffer, int offset, int length); 00031 using AbstractOutputStream::write; 00032 void close(); 00033 00034 private: 00035 FileDescriptorOutputStream(const FileDescriptorOutputStream& other); 00036 FileDescriptorOutputStream& operator = (const FileDescriptorOutputStream& other); 00037 00038 sk::io::FileDescriptor _descriptor; 00039 }; 00040 } 00041 } 00042 00043 #endif /* _SK_IO_FILEDESCRIPTOROUTPUTSTREAM_ */