Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Cyberdog Programmer's Kit / Part 3 - Cyberdog Reference
Chapter 7 - Classes and Methods / CyberStream


GetBuffer

Retrieves a buffer from this Cyberdog stream.

void GetBuffer (in Ptr* buffer, in Size* bufferSize);
buffer
A pointer to a pointer to a memory buffer. On return, the buffer contains the downloaded data.
bufferSize
A pointer to the length of the buffer. On return, the length is set to the number of bytes in the buffer.
DISCUSSION
Each stream object has memory buffers to hold incoming data. You determine whether a stream object has data available by calling the stream's GetStreamStatus method and checking the kCDDataAvailable flag. If the kCDDataAvailable flag is set, the stream has been opened successfully and there is at least one buffer of non-zero length available.

When the stream object has data available, you can call GetBuffer to retrieve a buffer from the stream. The contents of the buffer are read only; you cannot modify them. You can retrieve more than one buffer at a time. If the call to GetBuffer cannot be completed, the method sets the value of buffer to kODNULL and the value of bufferSize to 0.

When you call GetStreamStatus and the value of the kCDDownloadComplete flag is true, you have retrieved all of the data and you do not need to call GetBuffer again. You release a buffer when you have finished using it by calling the ReleaseBuffer method.

GetBuffer may be called at interrupt time.

If you subclass CyberStream, you must override this method. Your override must not call its inherited method; that is, your override method must implement this method's functionality completely.

SEE ALSO
The StreamStatus type (page 179).
The ReleaseBuffer method (page 389).
The GetStreamStatus method (page 385).


Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996