D:/work/code_by/IOStream/PipedInputStream.cpp

查看本檔案說明文件.
00001 #include "PipedInputStream.h"
00002 
00003 TPipedInputStream::TPipedInputStream(TByteArrayOutputStream *Stream)
00004 {
00005   BAOStream = Stream;
00006   position = 0;
00007 }
00008 
00009 TPipedInputStream::~TPipedInputStream()
00010 {
00011 }
00012 
00013 int TPipedInputStream::Available(void)
00014 {
00015   return BAOStream->Size() - position;
00016 }
00017 
00018 void TPipedInputStream::Close(void)
00019 {
00020   BAOStream->Close();
00021   position = 0;
00022 }
00023 
00024 int TPipedInputStream::Position(void)
00025 {
00026   return position;
00027 }
00028 
00029 int TPipedInputStream::Read(void)
00030 {
00031   int result;
00032 
00033   if (BAOStream->Size() > position)
00034   {
00035     result = 0;
00036     BAOStream->ToByteArray(&result, position, 1);
00037     ++position;
00038     return result;
00039   }
00040   return -1;
00041 }
00042 
00043 void TPipedInputStream::Reset(void)
00044 {
00045   position = 0;
00046 }
00047 
00048 int TPipedInputStream::Skip(int size)
00049 {
00050   if (size < 0)
00051     return 0;
00052 
00053   if (position + size > BAOStream->Size())
00054     size = BAOStream->Size() - position;
00055   position += size;
00056   return size;
00057 }
00058 

產生日期:Tue Jul 11 11:52:19 2006, 專案:cbmr, 產生器:  doxygen 1.4.7