diff --git a/Sources/NIO/ByteBuffer-aux.swift b/Sources/NIO/ByteBuffer-aux.swift index fc8df682f9f..4549dee2ed5 100644 --- a/Sources/NIO/ByteBuffer-aux.swift +++ b/Sources/NIO/ByteBuffer-aux.swift @@ -259,6 +259,8 @@ extension ByteBuffer { /// `ByteBuffer` sharing the underlying storage with the `ByteBuffer` the method was invoked on. The returned /// `ByteBuffer` will contain the bytes in the range `readerIndex.. ByteBuffer { return getSlice(at: self.readerIndex, length: self.readableBytes)! @@ -271,6 +273,8 @@ extension ByteBuffer { /// original `ByteBuffer`. /// The `readerIndex` of the returned `ByteBuffer` will be `0`, the `writerIndex` will be `length`. /// + /// - note: Because `ByteBuffer` implements copy-on-write a copy of the storage will be automatically triggered when either of the `ByteBuffer`s sharing storage is written to. + /// /// - parameters: /// - length: The number of bytes to slice off. /// - returns: A `ByteBuffer` sharing storage containing `length` bytes or `nil` if the not enough bytes were readable.