00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef _DECAF_INTERNAL_NIO_BUFFERFACTORY_H_
00019 #define _DECAF_INTERNAL_NIO_BUFFERFACTORY_H_
00020
00021 #include <decaf/nio/ByteBuffer.h>
00022 #include <decaf/nio/CharBuffer.h>
00023 #include <decaf/nio/DoubleBuffer.h>
00024 #include <decaf/nio/FloatBuffer.h>
00025 #include <decaf/nio/LongBuffer.h>
00026 #include <decaf/nio/IntBuffer.h>
00027 #include <decaf/nio/ShortBuffer.h>
00028
00029 #include <decaf/lang/exceptions/IndexOutOfBoundsException.h>
00030
00031 namespace decaf{
00032 namespace internal{
00033 namespace nio{
00034
00041 class DECAF_API BufferFactory {
00042 public:
00043
00044 virtual ~BufferFactory() {}
00045
00057 static decaf::nio::ByteBuffer* createByteBuffer( int capacity );
00058
00082 static decaf::nio::ByteBuffer* createByteBuffer(
00083 unsigned char* buffer, int size, int offset, int length );
00084
00100 static decaf::nio::ByteBuffer* createByteBuffer( std::vector<unsigned char>& buffer );
00101
00113 static decaf::nio::CharBuffer* createCharBuffer( int capacity );
00114
00138 static decaf::nio::CharBuffer* createCharBuffer( char* buffer, int size, int offset, int length );
00139
00155 static decaf::nio::CharBuffer* createCharBuffer( std::vector<char>& buffer );
00156
00168 static decaf::nio::DoubleBuffer* createDoubleBuffer( int capacity );
00169
00193 static decaf::nio::DoubleBuffer* createDoubleBuffer( double* buffer, int size, int offset, int length );
00194
00210 static decaf::nio::DoubleBuffer* createDoubleBuffer( std::vector<double>& buffer );
00211
00223 static decaf::nio::FloatBuffer* createFloatBuffer( int capacity );
00224
00248 static decaf::nio::FloatBuffer* createFloatBuffer( float* buffer, int size, int offset, int length );
00249
00265 static decaf::nio::FloatBuffer* createFloatBuffer( std::vector<float>& buffer );
00266
00275 static decaf::nio::LongBuffer* createLongBuffer( int capacity );
00276
00300 static decaf::nio::LongBuffer* createLongBuffer( long long* buffer, int size, int offset, int length );
00301
00317 static decaf::nio::LongBuffer* createLongBuffer( std::vector<long long>& buffer );
00318
00330 static decaf::nio::IntBuffer* createIntBuffer( int capacity );
00331
00355 static decaf::nio::IntBuffer* createIntBuffer( int* buffer, int size, int offset, int length );
00356
00372 static decaf::nio::IntBuffer* createIntBuffer( std::vector<int>& buffer );
00373
00385 static decaf::nio::ShortBuffer* createShortBuffer( int capacity );
00386
00410 static decaf::nio::ShortBuffer* createShortBuffer( short* buffer, int size, int offset, int length );
00411
00427 static decaf::nio::ShortBuffer* createShortBuffer( std::vector<short>& buffer );
00428
00429 };
00430
00431 }}}
00432
00433 #endif