refactor/ThoughtWorks.QRCode/Codec/Util/SystemUtils.cs

(开头部分) 3KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

namespace ThoughtWorks.QRCode.Codec.Util
{
    using System;
    using System.IO;
    using System.Text;

    public class SystemUtils
    {
        public static int ReadInput(Stream sourceStream, sbyte[] target, int start, int count)
        {
            if (target.Length == 0)
            {
                return 0;
            }
            byte[] buffer = new byte[target.Length];
            int num = sourceStream.Read(buffer, start, count);
            if (num == 0)
            {
                return -1;
            }
            for (int i = start; i < (start + num); i++)
            {
                target[i] = (sbyte) buffer[i];
            }
            return num;
        }

        public static int ReadInput(TextReader sourceTextReader, short[] target, int start, int count)
        {
            if (target.Length == 0)
            {
                return 0;
            }
            char[] buffer = new char[target.Length];
            int num = sourceTextReader.Read(buffer, start, count);
            if (num == 0)
            {
                return -1;
            }
            for (int i = start; i < (start + num); i++)
            {
                target[i] = (short) buffer[i];
            }
            return num;
        }

        public static byte[] ToByteArray(string sourceString) => 
            Encoding.UTF8.GetBytes(sourceString);

        public static byte[] ToByteArray(object[] tempObjectArray)
        {
            byte[] buffer = null;
            if (tempObjectArray != null)
            {
                buffer = new byte[tempObjectArray.Length];
                for (int i = 0; i < tempObjectArray.Length; i++)
                {
                    buffer[i] = (byte) tempObjectArray[i];
                }
            }
后面还有 69 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。