BplusDotNet.BufferFile.RetrieveLong C# (CSharp) Метод

RetrieveLong() публичный статический Метод

public static RetrieveLong ( byte ToArray, int atIndex ) : long
ToArray byte
atIndex int
Результат long
        public static long RetrieveLong(byte[] ToArray, int atIndex)
        {
            int limit=LONGSTORAGE;
            if (atIndex+limit>ToArray.Length)
            {
                throw new BufferFileException("can't access beyond end of array");
            }
            long result = 0;
            for (int i=0; i<limit; i++)
            {
                byte thebyte = ToArray[atIndex+limit-i-1];
                result = result << 8;
                result = result | thebyte;
            }
            return result;
        }

Usage Example

Пример #1
0
        void readHeader()
        {
            byte[] header = new byte[this.headersize];
            this.fromfile.Seek(this.seekStart, System.IO.SeekOrigin.Begin);
            this.fromfile.Read(header, 0, this.headersize);
            int index = 0;

            // check prefix
            foreach (byte b in HEADERPREFIX)
            {
                if (header[index] != b)
                {
                    throw new LinkedFileException("invalid header prefix");
                }
                index++;
            }
            // skip version (for now)
            index++;
            // read buffersize
            this.buffersize   = BufferFile.Retrieve(header, index);
            index            += BufferFile.INTSTORAGE;
            this.FreeListHead = BufferFile.RetrieveLong(header, index);
            this.sanityCheck();
            this.headerDirty = false;
        }
All Usage Examples Of BplusDotNet.BufferFile::RetrieveLong