Esempio n. 1
0
        public ReadBlock ReadBlock(char[] buffer, long count, IList <string> _rejectionList)
        {
            throw new NotImplementedException();
            var ret = new ReadBlock();

            return(ret);
        }
Esempio n. 2
0
        private void FillCurrentPage(long requestedOffset)
        {
            long offsetStart = _stream.GetPosition();

            char[]    buffer          = new char[MAX_PAGE_SIZE_IN_BYTES];
            ReadBlock block           = _stream.ReadBlock(buffer, MAX_PAGE_SIZE_IN_BYTES, RejectionList);
            long      currentPageSize = block.SizeInBytes;
            long      offsetStop      = offsetStart + currentPageSize;

            _currentPage = new Page(offsetStart, offsetStop, currentPageSize, block.Content, requestedOffset);
        }
Esempio n. 3
0
        public IList <string> GetEndOfFile(long offsetStart, IList <string> rejectionList)
        {
            OpenFile();
            _fileInfo.Refresh();
            if (offsetStart > _fileInfo.Length)
            {
                Log.Error("file reduced size");
                return(new List <string>());
            }
            _currentPosition = offsetStart;
            _stream.Seek(offsetStart, SeekOrigin.Begin);
            long bytesToRead = _fileInfo.Length - offsetStart;

            char[]    buffer = new char[bytesToRead];
            ReadBlock block  = ReadBlock(buffer, bytesToRead, rejectionList);

            CloseFile();
            IList <string> ret = block.Content;

            return(ret);
        }
Esempio n. 4
0
        public ReadBlock ReadBlock(char[] buffer, long count, IList <string> rejectionList)
        {
            OpenFile();
            ReloadCurrentPosition();
            byte[] array  = new byte[count];
            int    nbRead = _stream.Read(array, 0, (int)count);

            string decoded            = _encoding.GetString(array, 0, nbRead);
            string char2StringTrimmed = decoded.TrimEnd();

            string[]       lines            = char2StringTrimmed.Split(LINE_SEPARATOR);
            IList <string> linesNotFiltered = lines.Select(x => x.TrimEnd()).ToList();
            IList <string> linesFiltered    = FilterLines(rejectionList, linesNotFiltered);
            var            ret = new ReadBlock
            {
                Content     = linesFiltered,
                SizeInBytes = nbRead
            };

            _currentPosition   = _stream.Position;
            _currentSeekOrigin = SeekOrigin.Begin;
            CloseFile();
            return(ret);
        }