public BoltWriter(Stream stream, int defaultBufferSize, int maxBufferSize, ILogger logger, bool supportBytes) { Throw.ArgumentNullException.IfNull(stream, nameof(stream)); _logger = logger; _chunkWriter = new ChunkWriter(stream, defaultBufferSize, maxBufferSize, logger); _packStreamWriter = supportBytes ? new PackStreamWriter(_chunkWriter.ChunkerStream) : new PackStreamWriterBytesIncompatible(_chunkWriter.ChunkerStream); }
private static byte[] CreateSuccessMessage() { var stream = new MemoryStream(); var writer = new PackStreamWriter(stream, null); writer.WriteStructHeader(1, BoltProtocolV3MessageFormat.MsgSuccess); writer.WriteMapHeader(1); writer.Write("x"); writer.Write(1); return(CreateChunkedMessage(stream.ToArray())); }
private static byte[] CreateNodeMessage() { var stream = new MemoryStream(); var writer = new PackStreamWriter(stream, null); writer.WriteStructHeader(3, NodeSerializer.Node); writer.Write(1L); writer.Write(new List <string> { "Label" }); writer.Write(new Dictionary <string, object>()); return(CreateChunkedMessage(stream.ToArray())); }