18#ifndef _DECAF_INTERNAL_UTIL_BYTEARRAYADAPTER_H_
19#define _DECAF_INTERNAL_UTIL_BYTEARRAYADAPTER_H_
216 return this->size / (int)
sizeof(
double);
224 return this->size / (int)
sizeof(
float);
232 return this->size / (int)
sizeof(
long long);
240 return this->size / (int)
sizeof(
int);
248 return this->size / (int)
sizeof(
short);
257 return this->array.bytes;
266 return this->array.chars;
275 return this->array.shorts;
284 return this->array.ints;
293 return this->array.longs;
302 return this->array.doubles;
311 return this->array.floats;
333 virtual void read(
unsigned char* buffer,
int size,
int offset,
int length)
const;
355 virtual void write(
unsigned char* buffer,
int size,
int offset,
int length);
404 virtual unsigned char get(
int index)
const;
772 void initialize(
unsigned char* buffer,
int size,
bool own);
ByteArrayAdapter(int size)
Creates a byte array object that is allocated internally and is then owned and deleted when this obje...
virtual void read(unsigned char *buffer, int size, int offset, int length) const
Reads from the Byte array starting at the specified offset and reading the specified length.
virtual double getDoubleAt(int index) const
Reads eight bytes at the given byte index and returns it.
virtual void write(unsigned char *buffer, int size, int offset, int length)
Writes from the Byte array given, starting at the specified offset and writing the specified amount o...
virtual int getInt(int index) const
Reads four bytes at the given index and returns it.
ByteArrayAdapter(short *array, int size, bool own=false)
Creates a byte array object that wraps the given array.
virtual ByteArrayAdapter & put(int index, unsigned char value)
Writes the given byte into this buffer at the given index.
virtual long long * getLongArray()
Gets the pointer to the array we are wrapping.
Definition ByteArrayAdapter.h:292
ByteArrayAdapter(int size)
Creates a byte array object that is allocated internally and is then owned and deleted when this obje...
virtual void clear()
Clear all data from that Array, setting the underlying bytes to zero.
virtual short * getShortArray()
Gets the pointer to the array we are wrapping.
Definition ByteArrayAdapter.h:274
virtual unsigned char get(int index) const
Absolute get method.
virtual int getIntAt(int index) const
Reads four bytes at the given byte index and returns it.
virtual char * getCharArray()
Gets the pointer to the array we are wrapping.
Definition ByteArrayAdapter.h:265
const unsigned char & operator[](int index) const
virtual long long getLongAt(int index) const
Reads eight bytes at the given byte index and returns it.
virtual ByteArrayAdapter & putLong(int index, long long value)
Writes eight bytes containing the given value, into this buffer at the given index.
virtual int * getIntArray()
Gets the pointer to the array we are wrapping.
Definition ByteArrayAdapter.h:283
virtual float getFloatAt(int index) const
Reads four bytes at the given byte index and returns it.
virtual float getFloat(int index) const
Reads four bytes at the given index and returns it.
virtual ByteArrayAdapter & putDoubleAt(int index, double value)
Writes eight bytes containing the given value, into this buffer at the given byte index.
virtual int getShortCapacity() const
Gets the size of the underlying array as if it contains shorts.
Definition ByteArrayAdapter.h:247
virtual ByteArrayAdapter & putFloat(int index, float value)
Writes four bytes containing the given value, into this buffer at the given index.
virtual unsigned char * getByteArray()
Gets the pointer to the array we are wrapping.
Definition ByteArrayAdapter.h:256
unsigned char & operator[](int index)
Allows the ByteArrayAdapter to be indexed as a standard array.
ByteArrayAdapter(int *array, int size, bool own=false)
Creates a byte array object that wraps the given array.
ByteArrayAdapter(long long *array, int size, bool own=false)
Creates a byte array object that wraps the given array.
virtual char getChar(int index) const
Reads one byte at the given index and returns it.
ByteArrayAdapter(char *array, int size, bool own=false)
Creates a byte array object that wraps the given array.
virtual int getCharCapacity() const
Gets the size of the underlying array as if it contains chars.
Definition ByteArrayAdapter.h:207
virtual void resize(int size)
Resizes the underlying array to the new given size, preserving all the Data that was previously in th...
virtual short getShort(int index) const
Reads two bytes at the given index and returns it.
virtual double * getDoubleArray()
Gets the pointer to the array we are wrapping.
Definition ByteArrayAdapter.h:301
virtual float * getFloatArray()
Gets the pointer to the array we are wrapping.
Definition ByteArrayAdapter.h:310
ByteArrayAdapter(unsigned char *array, int size, bool own=false)
Creates a byte array object that wraps the given array.
virtual ByteArrayAdapter & putShortAt(int index, short value)
Writes two bytes containing the given value, into this buffer at the given byte index.
virtual ByteArrayAdapter & putDouble(int index, double value)
Writes eight bytes containing the given value, into this buffer at the given index.
ByteArrayAdapter(float *array, int size, bool own=false)
Creates a byte array object that wraps the given array.
virtual int getLongCapacity() const
Gets the size of the underlying array as if it contains doubles.
Definition ByteArrayAdapter.h:231
virtual ByteArrayAdapter & putFloatAt(int index, float value)
Writes four bytes containing the given value, into this buffer at the given byte index.
virtual long long getLong(int index) const
Reads eight bytes at the given index and returns it.
virtual int getIntCapacity() const
Gets the size of the underlying array as if it contains ints.
Definition ByteArrayAdapter.h:239
virtual ~ByteArrayAdapter()
virtual ByteArrayAdapter & putChar(int index, char value)
Writes one byte containing the given value, into this buffer at the given index.
ByteArrayAdapter(double *array, int size, bool own=false)
Creates a byte array object that wraps the given array.
virtual ByteArrayAdapter & putShort(int index, short value)
Writes two bytes containing the given value, into this buffer at the given index.
virtual ByteArrayAdapter & putIntAt(int index, int value)
Writes four bytes containing the given value, into this buffer at the given byte index.
virtual int getFloatCapacity() const
Gets the size of the underlying array as if it contains doubles.
Definition ByteArrayAdapter.h:223
virtual double getDouble(int index) const
Reads eight bytes at the given index and returns it.
virtual ByteArrayAdapter & putLongAt(int index, long long value)
Writes eight bytes containing the given value, into this buffer at the given byte index.
virtual int getCapacity() const
Gets the size of the underlying array.
Definition ByteArrayAdapter.h:199
virtual int getDoubleCapacity() const
Gets the size of the underlying array as if it contains doubles.
Definition ByteArrayAdapter.h:215
virtual ByteArrayAdapter & putInt(int index, int value)
Writes four bytes containing the given value, into this buffer at the given index.
virtual short getShortAt(int index) const
Reads two bytes at the given byte index and returns it.
#define DECAF_API
Definition Config.h:29
Definition ByteArrayAdapter.h:30
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25