Module: Mongo::Protocol::Serializers::Bytes Private
Relationships & Source Files | |
Defined in: | lib/mongo/protocol/serializers.rb |
Overview
MongoDB wire protocol serialization strategy for n bytes.
Writes and fetches bytes from the byte buffer.
Class Method Summary
-
.deserialize(buffer, options = {}) ⇒ String
Internal use only
Deserializes bytes from the byte buffer.
-
.serialize(buffer, value, validating_keys = nil) ⇒ BSON::ByteBuffer
Internal use only
Writes bytes into the buffer.
Class Method Details
.deserialize(buffer, options = {}) ⇒ String
Deserializes bytes from the byte buffer.
# File 'lib/mongo/protocol/serializers.rb', line 460
def self.deserialize(buffer, = {}) num_bytes = [:num_bytes] buffer.get_bytes(num_bytes || buffer.length) end
.serialize(buffer, value, validating_keys = nil) ⇒ BSON::ByteBuffer
Writes bytes into the buffer.
# File 'lib/mongo/protocol/serializers.rb', line 446
def self.serialize(buffer, value, validating_keys = nil) buffer.put_bytes(value) end