@@ -46,7 +46,7 @@ extension RedisDataDecoder {
46
46
}
47
47
48
48
func _parse( at position: inout Int , from buffer: inout ByteBuffer ) throws -> _RedisDataDecodingState {
49
- guard let token = buffer. copyByte ( at: position) else { return . notYetParsed }
49
+ guard let token = buffer. copyBytes ( at: position, length : 1 ) ? . first else { return . notYetParsed }
50
50
51
51
position += 1
52
52
@@ -188,19 +188,6 @@ extension RedisDataDecoder {
188
188
}
189
189
190
190
private extension ByteBuffer {
191
- /// Copies the `ByteBuffer` from the current `readerIndex`.
192
- ///
193
- /// buffer.copyBytes(count: 5)
194
- /// // Optional(5 bytes)
195
- ///
196
- /// - Parameters:
197
- /// - count: The number of bytes to copy
198
- /// - skipping: The amount of bytes to skip, defaulting to `0`.
199
- func copyBytes( count: Int , skipping: Int = 0 ) -> [ UInt8 ] ? {
200
- guard readableBytes >= count + skipping else { return nil }
201
- return getBytes ( at: readerIndex + skipping, length: count)
202
- }
203
-
204
191
/// Copies bytes from the `ByteBuffer` from at the provided position, up to the length desired.
205
192
///
206
193
/// buffer.copyBytes(at: 3, length: 2)
@@ -213,15 +200,4 @@ private extension ByteBuffer {
213
200
guard readableBytes >= offset + length else { return nil }
214
201
return getBytes ( at: offset + readerIndex, length: length)
215
202
}
216
-
217
- /// Copies the first byte from the `ByteBuffer` at the desired position.
218
- ///
219
- /// buffer.copyByte(at: 3)
220
- /// // Optional(1 byte), assuming buffer contains 3 or more bytes
221
- ///
222
- /// - Parameter at: The position offset of the byte to be copied from the buffer.
223
- func copyByte( at position: Int ) -> UInt8 ? {
224
- guard readableBytes >= 1 else { return nil }
225
- return getBytes ( at: position, length: 1 ) ? . first
226
- }
227
203
}
0 commit comments