private void WriteStringValue(BionToken markerType, String8 value) { if (_compressor == null) { // Write marker and length WriteStringLength(markerType, value.Length); // Write value _writer.EnsureSpace(value.Length); value.CopyTo(_writer.Buffer, _writer.Index); _writer.Index += value.Length; } else { // Write marker for compressed, terminated value Write((byte)(markerType == BionToken.String ? BionMarker.StringCompressedTerminated : BionMarker.PropertyNameCompressedTerminated)); // Compress and write value using (BufferedReader reader = BufferedReader.FromString(value)) { _compressor.Compress(reader, _writer); } // Write end token Write(BionMarker.EndValue); } }