BN089-BS开发框架MVC4版/source20131023/Zephyr.Net/Zephyr.Utils/Document/Excel/NPOI/Util/ByteArrayInputStream.cs

(开头部分) 4KB

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

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace Zephyr.Utils.NPOI.Util
{
    public class ByteArrayInputStream : Stream
    {

        public ByteArrayInputStream()
        {
        }
        protected byte[] buf;
        protected int pos;
        protected int mark = 0;
        protected int count;
        public ByteArrayInputStream(byte[] buf)
        {
            this.buf = buf;
            this.pos = 0;
            this.count = buf.Length;
        }
        public ByteArrayInputStream(byte[] buf, int offset, int length)
        {
            this.buf = buf;
            this.pos = offset;
            this.count = Math.Min(offset + length, buf.Length);
            this.mark = offset;
        }
        
        public virtual int Read()
        {
            lock (this)
            {
                return (pos < count) ? (buf[pos++] & 0xff) : -1;
            }
        }
        public override int Read(byte[] b, int off, int len)
        {
            lock (this)
            {
                if (b == null)
                {
                    throw new NullReferenceException();
                }
                else if (off < 0 || len < 0 || len > b.Length - off)
                {
                    throw new IndexOutOfRangeException();
                }

                if (pos >= count)
                {
                    return -1;
                }

                int avail = count - pos;
                if (len > avail)
                {
                    len = avail;
后面还有 120 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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