Instance Method


Writes the contents of a provided data buffer to the receiver.


- (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)len;



The data to write.


The length of the data buffer, in bytes.

Return Value

A number indicating the outcome of the operation:

  • A positive number indicates the number of bytes written.

  • 0 indicates that a fixed-length stream and has reached its capacity.

  • -1 means that the operation failed; more information about the error can be obtained with streamError.

See Also

Using Streams


A boolean value that indicates whether the receiver can be written to.

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software