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_FILEDESCRIPTORINPUTSTREAM_ 00009 #define _SK_IO_FILEDESCRIPTORINPUTSTREAM_ 00010 00011 #include <sk/io/AbstractInputStream.h> 00012 #include <sk/io/FileDescriptor.h> 00013 00014 namespace sk { 00015 namespace io { 00016 class FileDescriptorInputStream 00017 : public sk::io::AbstractInputStream 00018 { 00019 public: 00020 FileDescriptorInputStream(int fd); 00021 FileDescriptorInputStream(const sk::io::FileDescriptor& descriptor); 00022 virtual ~FileDescriptorInputStream(); 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::InputStream implementation. 00030 int read(char* buffer, int offset, int length); 00031 using sk::io::AbstractInputStream::read; 00032 void close(); 00033 00034 private: 00035 FileDescriptorInputStream(const FileDescriptorInputStream& other); 00036 FileDescriptorInputStream& operator = (const FileDescriptorInputStream& other); 00037 00038 sk::io::FileDescriptor _descriptor; 00039 }; 00040 } 00041 } 00042 00043 #endif /* _SK_IO_FILEDESCRIPTORINPUTSTREAM_ */