* Writes bytes according to Cassandra * @param {Buffer|null|types.unset} bytes
(bytes)
| 66 | * @param {Buffer|null|types.unset} bytes |
| 67 | */ |
| 68 | writeBytes(bytes) { |
| 69 | if (bytes === null) { |
| 70 | //Only the length buffer containing -1 |
| 71 | this.writeInt(-1); |
| 72 | return; |
| 73 | } |
| 74 | if (bytes === types.unset) { |
| 75 | this.writeInt(-2); |
| 76 | return; |
| 77 | } |
| 78 | //Add the length buffer |
| 79 | this.writeInt(bytes.length); |
| 80 | //Add the actual buffer |
| 81 | this.add(bytes); |
| 82 | } |
| 83 | |
| 84 | /** |
| 85 | * Writes a buffer according to Cassandra protocol: bytes.length (2) + bytes |
no test coverage detected