@@ -2,34 +2,50 @@ import SystemPackage
22
33public extension FileDescriptor {
44 @inlinable func read( into buffer: ByteBuffer , retryOnInterrupt: Bool = true ) throws -> Int {
5- return try read ( into: buffer [ ... ] , retryOnInterrupt: retryOnInterrupt)
5+ return try buffer. slice ( ... ) { bytes in
6+ return try read ( into: bytes, retryOnInterrupt: retryOnInterrupt)
7+ }
68 }
79
810 @inlinable func readAll( into buffer: ByteBuffer , retryOnInterrupt: Bool = true ) throws {
9- return try readAll ( into: buffer [ ... ] , retryOnInterrupt: retryOnInterrupt)
11+ return try buffer. slice ( ... ) { bytes in
12+ return try readAll ( into: bytes, retryOnInterrupt: retryOnInterrupt)
13+ }
1014 }
1115
1216 @inlinable func read( fromAbsoluteOffset offset: Int64 , into buffer: ByteBuffer , retryOnInterrupt: Bool = true ) throws -> Int {
13- return try read ( fromAbsoluteOffset: offset, into: buffer [ ... ] , retryOnInterrupt: retryOnInterrupt)
17+ return try buffer. slice ( ... ) { bytes in
18+ return try read ( fromAbsoluteOffset: offset, into: bytes, retryOnInterrupt: retryOnInterrupt)
19+ }
1420 }
1521
1622 @inlinable func readAll( fromAbsoluteOffset offset: Int64 , into buffer: ByteBuffer , retryOnInterrupt: Bool = true ) throws {
17- return try readAll ( fromAbsoluteOffset: offset, into: buffer [ ... ] , retryOnInterrupt: retryOnInterrupt)
23+ return try buffer. slice ( ... ) { bytes in
24+ return try readAll ( fromAbsoluteOffset: offset, into: bytes, retryOnInterrupt: retryOnInterrupt)
25+ }
1826 }
1927
2028 @inlinable func write( _ buffer: ByteBuffer , retryOnInterrupt: Bool = true ) throws -> Int {
21- return try write ( UnsafeRawBufferPointer ( buffer [ ... ] ) , retryOnInterrupt: retryOnInterrupt)
29+ return try buffer. slice ( ... ) { bytes in
30+ return try write ( UnsafeRawBufferPointer ( bytes) , retryOnInterrupt: retryOnInterrupt)
31+ }
2232 }
2333
2434 @inlinable func write( toAbsoluteOffset offset: Int64 , _ buffer: ByteBuffer , retryOnInterrupt: Bool = true ) throws -> Int {
25- return try write ( toAbsoluteOffset: offset, UnsafeRawBufferPointer ( buffer [ ... ] ) , retryOnInterrupt: retryOnInterrupt)
35+ return try buffer. slice ( ... ) { bytes in
36+ return try write ( toAbsoluteOffset: offset, UnsafeRawBufferPointer ( bytes) , retryOnInterrupt: retryOnInterrupt)
37+ }
2638 }
2739
2840 @inlinable func writeAll( _ buffer: ByteBuffer ) throws {
29- try writeAll ( buffer [ ... ] )
41+ return try buffer. slice ( ... ) { bytes in
42+ try writeAll ( bytes)
43+ }
3044 }
3145
3246 @inlinable func writeAll( toAbsoluteOffset offset: Int64 , _ buffer: ByteBuffer ) throws {
33- try writeAll ( toAbsoluteOffset: offset, buffer [ ... ] )
47+ return try buffer. slice ( ... ) { bytes in
48+ try writeAll ( toAbsoluteOffset: offset, bytes)
49+ }
3450 }
3551}
0 commit comments