示例#1
0
        public int ReadPageData(FileStreamWrapper stream, int pageIdx)
        {
            if (null == stream)
            {
                throw new ArgumentNullException();
            }

            byte[] dataBuffer = new byte[PageSize];

            // read from the file stream
            if (0 > pageIdx ||
                stream.Length < (pageIdx + 1) * PageSize)
            {
                throw new InvalidPageException();
            }

            stream.Seek(pageIdx * PageSize, SeekOrigin.Begin);
            stream.Read(dataBuffer, 0, dataBuffer.Length);

            // initialize members
            this.recordList = new List <byte[]>();
            this.ReadPageData(dataBuffer);

            return(pageIdx);
        }
示例#2
0
        public int ReadPageData(FileStreamWrapper stream, int pageIdx)
        {
            if (null == stream)
            {
                throw new ArgumentNullException();
            }

            byte[] dataBuffer = new byte[PageSize];

            // read from the file stream
            if (0 > pageIdx
                || stream.Length < (pageIdx + 1) * PageSize)
            {
                throw new InvalidPageException();
            }

            stream.Seek(pageIdx * PageSize, SeekOrigin.Begin);
            stream.Read(dataBuffer, 0, dataBuffer.Length);

            // initialize members
            this.recordList = new List<byte[]>();
            this.ReadPageData(dataBuffer);

            return pageIdx;
        }