00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_NIO_INTBUFFER_H_
00019 #define _DECAF_NIO_INTBUFFER_H_
00020
00021 #include <decaf/nio/Buffer.h>
00022 #include <decaf/lang/Comparable.h>
00023 #include <decaf/lang/exceptions/NullPointerException.h>
00024 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
00025 #include <decaf/nio/BufferUnderflowException.h>
00026 #include <decaf/nio/BufferOverflowException.h>
00027 #include <decaf/nio/ReadOnlyBufferException.h>
00028
00029 namespace decaf{
00030 namespace nio{
00031
00050 class DECAF_API IntBuffer : public Buffer,
00051 public lang::Comparable<IntBuffer> {
00052 protected:
00053
00064 IntBuffer( int capacity );
00065
00066 public:
00067
00068 virtual ~IntBuffer() {}
00069
00073 virtual std::string toString() const;
00074
00089 virtual int* array() = 0;
00090
00103 virtual int arrayOffset() = 0;
00104
00122 virtual IntBuffer* asReadOnlyBuffer() const = 0;
00123
00142 virtual IntBuffer& compact() = 0;
00143
00157 virtual IntBuffer* duplicate() = 0;
00158
00167 virtual int get() = 0;
00168
00180 virtual int get( int index ) const = 0;
00181
00196 IntBuffer& get( std::vector<int> buffer );
00197
00227 IntBuffer& get( int* buffer, int size, int offset, int length );
00228
00238 virtual bool hasArray() const = 0;
00239
00260 IntBuffer& put( IntBuffer& src );
00261
00289 IntBuffer& put( const int* buffer, int size, int offset, int length );
00290
00303 IntBuffer& put( std::vector<int>& buffer );
00304
00318 virtual IntBuffer& put( int value ) = 0;
00319
00334 virtual IntBuffer& put( int index, int value ) = 0;
00335
00349 virtual IntBuffer* slice() const = 0;
00350
00351 public:
00352
00356 virtual int compareTo( const IntBuffer& value ) const;
00357
00361 virtual bool equals( const IntBuffer& value ) const;
00362
00366 virtual bool operator==( const IntBuffer& value ) const;
00367
00371 virtual bool operator<( const IntBuffer& value ) const;
00372
00373 public:
00374
00387 static IntBuffer* allocate( int capacity );
00388
00413 static IntBuffer* wrap( int* array, int size, int offset, int length );
00414
00430 static IntBuffer* wrap( std::vector<int>& buffer );
00431
00432 };
00433
00434 }}
00435
00436 #endif