Do the stream classes in Cocoa support seeking?

前端 未结 1 1890
南旧
南旧 2021-01-22 07:23

I need a Cocoa class that can read and write from a memory stream and that supports seeking. In C#, MemoryStream supports the method seek, and in Java,

1条回答
  •  逝去的感伤
    2021-01-22 07:59

    An arbitrary NSInputStream and NSOutputStream don't appear to support random offset seeking, and creating subclasses of them is notoriously difficult.

    If you're going to be doing this reading and writing to a local file on disk (which I think you'd have to be, since I'm not sure how you could seek to a random offset on a network connection...), then what you're probably looking for is NSFileHandle.

    0 讨论(0)
提交回复
热议问题