< Summary

Class:Itinero.IO.StreamExtensions
Assembly:Itinero
File(s):/home/runner/work/routing2/routing2/src/Itinero/IO/StreamExtensions.cs
Covered lines:15
Uncovered lines:0
Coverable lines:15
Total lines:29
Line coverage:100% (15 of 15)
Covered branches:0
Total branches:0
Tag:224_14471318300

Metrics

MethodBranch coverage Cyclomatic complexity Line coverage
WriteWithSize(...)100%1100%
WriteWithSize(...)100%1100%
ReadWithSizeString(...)100%1100%

File(s)

/home/runner/work/routing2/routing2/src/Itinero/IO/StreamExtensions.cs

#LineLine coverage
 1using System;
 2using System.IO;
 3
 4namespace Itinero.IO;
 5
 6internal static class StreamExtensions
 7{
 8    internal static long WriteWithSize(this Stream stream, string value)
 239    {
 2310        var bytes = System.Text.Encoding.Unicode.GetBytes(value);
 2311        return stream.WriteWithSize(bytes);
 2312    }
 13
 14    internal static long WriteWithSize(this Stream stream, byte[] value)
 2315    {
 2316        stream.Write(BitConverter.GetBytes((long)value.Length), 0, 8);
 2317        stream.Write(value, 0, value.Length);
 2318        return value.Length + 8;
 2319    }
 20
 21    internal static string ReadWithSizeString(this Stream stream)
 2322    {
 2323        var size = stream.ReadInt64();
 2324        var data = new byte[size];
 2325        stream.Read(data, 0, (int)size);
 26
 2327        return System.Text.Encoding.Unicode.GetString(data, 0, data.Length);
 2328    }
 29}