Class: Neo4j::Core::PackStream::Unpacker
- Inherits:
-
Object
- Object
- Neo4j::Core::PackStream::Unpacker
- Defined in:
- lib/neo4j/core/cypher_session/adaptors/bolt/pack_stream.rb
Overview
Object which holds a stream of PackStream data and can unpack it
Constant Summary collapse
- HEADER_BASE_BYTES =
{text: 0xD0, list: 0xD4, struct: 0xDC, map: 0xD8}.freeze
Instance Method Summary collapse
-
#initialize(stream) ⇒ Unpacker
constructor
A new instance of Unpacker.
- #unpack_value! ⇒ Object
Constructor Details
#initialize(stream) ⇒ Unpacker
Returns a new instance of Unpacker.
185 186 187 |
# File 'lib/neo4j/core/cypher_session/adaptors/bolt/pack_stream.rb', line 185 def initialize(stream) @stream = stream end |
Instance Method Details
#unpack_value! ⇒ Object
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/neo4j/core/cypher_session/adaptors/bolt/pack_stream.rb', line 191 def unpack_value! return nil if depleted? marker = shift_byte! if type_and_size = PackStream.marker_type_and_size(marker) type, size = type_and_size shift_value_for_type!(type, size, marker) elsif MARKER_TYPES.key?(marker) MARKER_TYPES[marker] else marker >= 0xF0 ? -0x100 + marker : marker end end |