2010-12-04 16:14:34 +00:00
|
|
|
|
/********************************************************
|
|
|
|
|
* Stream.h *
|
|
|
|
|
* *
|
|
|
|
|
* XFX Stream definition file *
|
|
|
|
|
* Copyright <EFBFBD> XFX Team. All Rights Reserved *
|
|
|
|
|
********************************************************/
|
|
|
|
|
#ifndef _SYSTEM_IO_STREAM_
|
|
|
|
|
#define _SYSTEM_IO_STREAM_
|
|
|
|
|
|
2011-03-10 22:55:43 +00:00
|
|
|
|
#include <System/Types.h>
|
2010-12-04 16:14:34 +00:00
|
|
|
|
#include "Enums.h"
|
2011-03-10 22:55:43 +00:00
|
|
|
|
#include <System/Delegates.h>
|
|
|
|
|
#include <System/Interfaces.h>
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
|
|
|
|
namespace System
|
|
|
|
|
{
|
|
|
|
|
class WaitHandle;
|
|
|
|
|
|
|
|
|
|
namespace IO
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Provides a generic view of a sequence of bytes.
|
|
|
|
|
/// </summary>
|
|
|
|
|
class Stream : public IDisposable
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
int _asyncActiveCount;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
virtual void Dispose(bool disposing);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual bool CanRead();
|
|
|
|
|
virtual bool CanSeek();
|
|
|
|
|
virtual bool CanTimeOut();
|
|
|
|
|
virtual bool CanWrite();
|
|
|
|
|
virtual Int64 Length();
|
|
|
|
|
Int64 Position;
|
|
|
|
|
int ReadTimeOut;
|
|
|
|
|
int WriteTimeOut;
|
2011-03-10 22:55:43 +00:00
|
|
|
|
static const Stream* Null;
|
|
|
|
|
|
|
|
|
|
Stream();
|
|
|
|
|
virtual ~Stream();
|
2010-12-04 16:14:34 +00:00
|
|
|
|
|
2011-03-10 22:55:43 +00:00
|
|
|
|
virtual IAsyncResult* BeginRead(byte buffer[], int offset, int count, AsyncCallback callback, Object* state);
|
|
|
|
|
virtual IAsyncResult* BeginWrite(byte buffer[], int offset, int count, AsyncCallback callback, Object* state);
|
2010-12-04 16:14:34 +00:00
|
|
|
|
virtual void Close();
|
|
|
|
|
void Dispose();
|
2011-03-10 22:55:43 +00:00
|
|
|
|
virtual int EndRead(IAsyncResult* asyncResult);
|
|
|
|
|
virtual void EndWrite(IAsyncResult* asyncResult);
|
2010-12-04 16:14:34 +00:00
|
|
|
|
virtual void Flush();
|
|
|
|
|
virtual int Read(byte buffer[], int offset, int count);
|
|
|
|
|
virtual int ReadByte();
|
|
|
|
|
virtual Int64 Seek(Int64 offset, SeekOrigin_t origin);
|
|
|
|
|
virtual void SetLength(Int64 value);
|
|
|
|
|
virtual void Write(byte buffer[], int offset, int count);
|
|
|
|
|
virtual void WriteByte(byte value);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif //_SYSTEM_IO_STREAM_
|