/* -----------------------------------------------------------------------------
	GSFramework
	Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */


#ifndef	__NIOHANDLESEGMENT__
#define	__NIOHANDLESEGMENT__


		#include "filesystem/io_handle.h"
		#include "memory/nauto_ptr.h"


namespace GS {
	namespace IO {

//
class	HandleSegment : public Handle
{
		Handle		*handle;
		size_t		offset, size;
		size_t		cursor;

public:

virtual	size_t			GetSize();

virtual	size_t			Tell();
virtual	size_t			Seek(ptrdiff_t, Base::SeekRef = Base::SeekCurrent);

virtual	size_t			Read(void *, size_t);
virtual	size_t			Write(const void *, size_t);

		HandleSegment(Handle *h, size_t o, size_t s) : Handle(0), handle(h), offset(o), size(s), cursor(0) {}
};

	}	// IO
}	// GS


#endif	// __NIOHANDLESEGMENT__
