Пример #1
0
        private IByteBlock ReadByteBlockFromArchive()
        {
            if (!CanRead)
            {
                throw new InvalidOperationException("The file couldn't be read.");
            }
            byte[] binaryFinalByteBlockSize = new byte[sizeof(int)];
            byte[] binaryIndexByteBlock     = new byte[sizeof(int)];
            _fileStream.Read(binaryFinalByteBlockSize, 0, binaryFinalByteBlockSize.Length);
            _fileStream.Read(binaryIndexByteBlock, 0, binaryIndexByteBlock.Length);

            var byteBlock = new ByteBlock(BitConverter.ToInt32(binaryIndexByteBlock), BitConverter.ToInt32(binaryFinalByteBlockSize));

            _fileStream.Read(byteBlock.Buffer, 0, byteBlock.BufferSize);

            return(byteBlock);
        }