jw
06/18/2022, 8:37 PMJeff Lockhart
06/20/2022, 4:30 PMByteArray to NSData with other platform type conversions.
I'd be happy to take a stab at implementing a solution. Just need to familiarize myself with the code first. Feel free to share any guidance or suggestions.Jeff Lockhart
06/20/2022, 9:10 PMjava.io.InputStream.jw
06/20/2022, 9:20 PMjw
06/20/2022, 9:20 PMJeff Lockhart
06/20/2022, 9:27 PMBufferedSource.inputStream(), but not Source.inputStream(). Is that what you're referring to? Perhaps BufferedSource is the appropriate unifying API for java.io.InputStream and NSInputStream.jw
06/20/2022, 9:45 PMJeff Lockhart
06/20/2022, 9:54 PMSource, then in the platform implementations, call buffer().inputStream() to convert to java.io.InputStream or NSInputStream.
Since the appleMain source set inherits BufferedSource from the nonJvmMain source set, would it make sense to implement BufferedSource.inputStream(): NSInputStream as an extension function?jw
06/20/2022, 10:10 PMjw
06/20/2022, 10:12 PMJeff Lockhart
06/20/2022, 10:20 PMBufferedSource would be non-trivial, which is what would allow it to work similar to the jvmMain implementation, adding the additional inputStream() function to the interface.
Besides the default implementation route, I was also thinking how it could be nice for source sets to override an inherited actual declaration with their own more granular version.Jeff Lockhart
06/20/2022, 10:28 PMJeff Lockhart
06/20/2022, 10:32 PMNSInputStream instead of okio's Source API. But it wouldn't be a strict requirement to provide such an API.Jeff Lockhart
06/20/2022, 10:34 PMJeff Lockhart
06/20/2022, 10:38 PMJeff Lockhart
06/21/2022, 3:44 AMBufferedSource.inputStream(): NSInputStream.Jeff Lockhart
06/21/2022, 4:01 AMNSInputStream.source(): Source. In this direction, you can actually avoid the data copy, as ByteArray can be written to as a CPointer.Jeff Lockhart
06/21/2022, 7:11 AMNSInputStream additions on this branch. Let me know what you think. I can make a PR.jw
06/22/2022, 3:13 PMJeff Lockhart
06/22/2022, 8:37 PM