I am trying to create an iPhone app, although I am completely new to Obj-C. For one problem, I would use ByteBuffer in Java, but I don't see a suitable class in the Apple documentation. Therefore, I probably should implement this myself.
My question is: how to do this best:
You probably want to get NSMutableData.
java.nio.ByteBuffer ( Java ) , ByteBuffer / . NSInputStream, NSData ( ):
java.nio.ByteBuffer
ByteBuffer
NSInputStream
NSData
NSInputStream *inputStream = [NSInputStream inputStreamwithData:myData]; //assuming myData is NSData* float myFloat; if([inputStream hasBytesAvailable]) { // NO if you've already read to the end of myData NSInteger bytesRead = [inputStream read:&myFloat maxLength:sizeof(myFloat)]; NSAssert(bytesRead == sizeof(myFloat); }
- NSOutputStream NSData.
NSOutputStream
. .
- Obj-C java.nio.ByteBuffer. , ,
.
, NSInputStream NSOutputStream. NSMutableData, .
NSMutableData
Source: https://habr.com/ru/post/1705271/More articles:Is there a WPF XAML for a consistent fit, but a constant StrokeThickness - .netDoctest for dynamically created objects - pythonМаршрутизация веб-форм. Невозможно создать абстрактный класс. - c#What is a good hashing algorithm for seeding prng with a string? - stringПочему не могут быть разделены списки Win32:: TieRegistry? - perlProduct Quality OpenSocial.NET library? - .netiOS низкоуровневая сериализация - optimizationHow to make a table read-only using ASP.NET dynamic architectural data - asp.netRequest for an object (example) - c #MySQL ORDER Task - sqlAll Articles