Exemple #1
0
        private static string ToString(ByteArray byteArray, ByteArrayReaderCache <ByteArray, string> byteArrayCache)
        {
            if (byteArrayCache.TryGetValue(byteArray, out var str))
            {
                // The string seems to already be in the cache. Check that the content matches.
                if (IsCacheValid(byteArrayCache, byteArray, str))
                {
                    return(str);
                }

                // The cache does not appear to be valid anymore.
                byteArrayCache.Clear();
            }

            return(byteArrayCache.Add(byteArray, LogicalRead.ToString(byteArray)));
        }
Exemple #2
0
 private static void ConvertString(ReadOnlySpan <ByteArray> source, ReadOnlySpan <short> defLevels, Span <string> destination, short nullLevel)
 {
     for (int i = 0, src = 0; i != destination.Length; ++i)
     {
         destination[i] = !defLevels.IsEmpty && defLevels[i] == nullLevel ? null : LogicalRead.ToString(source[src++]);
     }
 }