OSData



Member Functions

appendBytes

Abstract: A member function which appends the data contained in an OSData object to the receiver.
public:

virtual bool appendBytes(const OSData *other);

Parameters

NameDescription
otherAn OSData object.
Result: Returns true if appending the new data was successful, false otherwise.

appendBytes

Abstract: A member function which appends a buffer of data onto the end of the object's internal data buffer.
public:

virtual bool appendBytes(const void *bytes, unsigned int inLength);

Parameters

NameDescription
bytesA pointer to the block of data.
inLengthThe length of the data block.
Result: Returns true if the object was able to append the new data, false otherwise.

ensureCapacity

Abstract: A member function which will expand the size of the collection to a given storage capacity.
public:

virtual unsigned int ensureCapacity(unsigned int newCapacity);

Parameters

NameDescription
newCapacityThe new capacity for the data buffer.
Result: Returns the new capacity of the data buffer or the previous capacity upon error.

free

Abstract: A member function which releases all resources created or used by the OSData object.
public:

virtual void free();

Do not call this function directly, use release() instead.


getBytesNoCopy

Abstract: A member function to return a pointer to the OSData object's internal data buffer.
public:

virtual const void *getBytesNoCopy() const;

Result: Returns a reference to the OSData object's internal data buffer.

getBytesNoCopy

Abstract: Returns a reference into the OSData object's internal data buffer at particular offset and with a particular length.
public:

virtual const void *getBytesNoCopy(unsigned int start, unsigned int inLength) const;

Parameters

NameDescription
startThe offset from the base of the internl data buffer.
inLengthThe length of window.
Result: Returns a pointer at a particular offset into the data buffer, or 0 if the starting offset or length are not valid.

getCapacity

Abstract: A member function which returns the capacity of the internal data buffer.
public:

virtual unsigned int getCapacity() const;

Result: Returns an integer value for the size of the object's internal data buffer.

getCapacityIncrement

Abstract: A member function which returns the size by which the data buffer will grow.
public:

virtual unsigned int getCapacityIncrement() const;

Result: Returns the size by which the data buffer will grow.

getLength

Abstract: A member function which returns the length of the internal data buffer.
public:

virtual unsigned int getLength() const;

Result: Returns an integer value for the length of data in the object's internal data buffer.

initWithBytes

Abstract: A member function to initialize an instance of OSData with the provided data.
public:

virtual bool initWithCapacity(unsigned int inCapacity);

Parameters

NameDescription
bytesA pointer to a block of data to be copied.
inLengthThe length of the block of data.
Result: Returns true if initialization was successful, false otherwise.

initWithBytes

Abstract: A member function to initialize an instance of OSData which references a block of data.
public:

virtual bool initWithBytes(const void *bytes, unsigned int inLength);

Parameters

NameDescription
bytesA reference to a block of data
inLengthThe length of the block of data.
Result: Returns true if initialization was successful, false otherwise.

initWithBytes

Abstract: A member function to initialize an instance of OSData which references a block of data.
public:

virtual bool initWithBytesNoCopy(void *bytes, unsigned int inLength);

Parameters

NameDescription
bytesA reference to a block of data
inLengthThe length of the block of data.
Result: Returns true if initialization was successful, false otherwise.

initWithData

Abstract: A member function to initialize an instance of OSData with the data provided.
public:

virtual bool initWithData(const OSData *inData);

Parameters

NameDescription
inDataAn OSData object which provides the data to be copied.
Result: Returns true if initialization was successful, false otherwise.

initWithData

Abstract: A member function to initialize an instance of OSData with a specific range of the data provided
public:

virtual bool initWithData(const OSData *inData, unsigned int start, unsigned int inLength);

Parameters

NameDescription
inDataAn OSData object.
startThe starting range of data to be copied.
inLengthThe length in bytes of the data to be copied.
Result: Returns true if initialization was successful, false otherwise.

isEqualTo

Abstract: A member function to test the equality between an OSData object and an arbitrary OSObject derived object.
public:

virtual bool isEqualTo(const OSObject *obj) const;

Parameters

NameDescription
objAn OSObject derived object.
Result: Returns true if the two objects are equivalent.

isEqualTo

Abstract: A member function to test the equality of an arbitrary block of data with the OSData object's internal data buffer.
public:

virtual bool isEqualTo(const void *someData, unsigned int inLength) const;

Parameters

NameDescription
someDataA pointer to a block of data.
inLengthThe length of the block of data.
Result: Returns true if the two blocks of data are equivalent, false otherwise.

isEqualTo

Abstract: A member function to test the equality of two OSData objects.
public:

virtual bool isEqualTo(const OSData *aData) const;

Parameters

NameDescription
aDataThe OSData object to be compared to the receiver.
Result: Returns true if the two objects are equivalent, false otherwise.

serialize

Abstract: A member function which archives the receiver.
public:

virtual bool serialize(OSSerialize *s) const;

Parameters

NameDescription
sThe OSSerialize object.
Result: Returns true if serialization was successful, false if not.

setCapacityIncrement

Abstract: A member function which sets the growth size of the data buffer.
public:

virtual unsigned int setCapacityIncrement(unsigned increment);

Result: Returns the new growth size.

withBytes

Abstract: A static constructor function to create and initialize an instance of OSData and copies in the provided data.
public:

static OSData *withBytes(const void *bytes, unsigned int inLength);

Parameters

NameDescription
bytesA buffer of data.
inLengthThe size of the given buffer.
Result: Returns an instance of OSData or 0 if a failure occurrs.

withBytesNoCopy

Abstract: A static constructor function to create and initialize an instance of OSData which references a buffer of data.
public:

static OSData *withBytesNoCopy(void *bytes, unsigned int inLength);

Parameters

NameDescription
bytesA reference to a block of data.
inLengthThe size of the data block.
Result: Returns an instance of OSData or 0 if a failure occurrs.

withCapacity

Abstract: A static constructor function to create and initialize an empty instance of OSData with a given capacity.
public:

static OSData *withCapacity(unsigned int inCapacity);

Parameters

NameDescription
inCapacityThe initial capacity of the OSData object in bytes.
Result: Returns an instance of OSData or 0 if a failure occurrs.

withData

Abstract: A static constructor function to create and initialize an instance of OSData with the data provided.
public:

static OSData *withData(const OSData *inData);

Parameters

NameDescription
inDataAn OSData object which provides the initial data.
Result: Returns an instance of OSData or 0 if a failure occurrs.

withData

Abstract: A static constructor function to create and initialize an instance of OSData with a specific range of the data provided.
public:

static OSData *withData(const OSData *inData, unsigned int start, unsigned int inLength);

Parameters

NameDescription
inDataAn OSData object which provides the initial data.
startThe starting index at which the data will be copied.
inLengthThe number of bytes to be copied starting at index 'start'.
Result: Returns an instance of OSData or 0 if a failure occurrs.

© 2000 Apple Computer, Inc. — (Last Updated 2/23/2000)