![]() |
URLGetBuffer |
||||
Header: | URLAccess.h | Carbon status: | Supported | |
Obtains the next buffer of data in a download operation.
OSStatus URLGetBuffer ( URLReference urlRef, void **buffer, Size *bufferSize );
A reference to the URL whose next buffer you wish to obtain.
On return, a handle to a buffer containing the downloaded data.
On return, a pointer to the number of bytes of data in the buffer.
A result code.
The URLGetBuffer function obtains the next buffer of data in a download operation. URLGetBuffer does not enable you to retain or modify the transferred data. If you pass NULL in the fileSpec parameter of the function URLOpen, you should call URLGetBuffer to retrieve data as it is downloaded.
You should call URLGetBuffer repeatedly until URL Access Manager passes the event constant kURLCompletedEvent or kURLAbortInitiatedEvent in the event parameter of your notification callback function, or until the function URLGetCurrentState returns the state constant kURLTransactionComplete or kURLAbortingState. Between calls to URLGetBuffer, you should call the function URLIdle to allow time for the URL Access Manager to refill its buffers.
To determine the number of bytes remaining in the buffer, call the function URLGetDataAvailable. The size returned by URLGetDataAvailable does not include the number of bytes in transit to a buffer, nor does it include the amount of data not yet transferred from the URL.
You should release the returned buffer as soon as possible after a call to URLGetBuffer by calling the function URLReleaseBuffer. This prevents the URL Access Manager from running out of buffers.
Supported in Carbon. Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
© 2000 Apple Computer, Inc. (Last Updated 7/17/2000)