I want to prepare a binary mess开发者_开发技巧age in memory before sending it over the network. What is the objective-c equivalent to Java's ByteArrayOutputStream?
I saw the somewhat complicated CFWriteStreamCreateWithAllocatedBuffers, and the simpler looking [[NSOutputStream alloc] initToMemory], however - I was not able to figure out how to use any of those.
A code sample that initializes an output stream, write some data into it and get the results bytes (in some form, NSData or char* or whatever) would really help.
The documentation for NSOutputStream tells you what you need to do.
精彩评论