I think I donβt understand anything. NSInputStream can receive data from three places: a socket, an NSData object, or a file. You did not say that you want to use a socket that leaves the other two as data sources. In addition, documents for NSStream say only file-based streams are available. (NSStream review, third paragraph)
Given this, I think an NSData object would be a better choice. An NSData object will process both files and bytes (which, I think, is what you mean by data in memory).
But you consider it and say that you prefer to adhere to flows. Is there any other consideration here?
(Edit) Sorry, I had to make this a real answer. My answer to the question you described is that using NSData is indeed the right solution.
If you prefer a different answer, please give more details.
source share