mirror of
https://github.com/apple/swift-nio
synced 2026-11-24 04:37:54 +00:00
Motivation: As described in issue [#2878](https://github.com/apple/swift-nio/issues/2878), NIOFileSystem crashes when reading more than `ByteBuffer` capacity. Modifications: - Add a new static property, `byteBufferCapacity`, to `ByteCount` representing the maximum amount of bytes that can be written to `ByteBuffer`. - Throw a `FileSystemError` in `ReadableFileHandleProtocol.readToEnd(fromAbsoluteOffset:maximumSizeAllowed:)` when `maximumSizeAllowed` is more than `ByteCount.byteBufferCapacity`. Result: NIOFileSystem will `throw` instead of crashing.