@Override
        public LogEntry next() {
            if (this.currentFileId == -1)
                return null;
            byte[] data;
            while (true) {
                if (currentFileId >= this.files.length)
                    return null;
                final SegmentFile segmentFile = (SegmentFile) this.files[currentFileId];
                if (segmentFile == null) {
                    return null;
                }

                data = segmentFile.lookupData(this.currentReadPos);
                if (data == null) {
                    // Reach file end
                    this.currentFileId += 1;
                    this.currentReadPos = FileHeader.HEADER_SIZE;
                } else {
                    this.preReadPos = this.currentReadPos;
                    this.currentReadPos += SegmentFile.getWriteBytes(data);
                    return this.logEntryDecoder.decode(data);
                }
            }
        }
@param files target files
@param logEntryDecoder decoder
@param currentReadPos the beginning read position in the first file
jraft-extension/java-log-storage-impl/src/main/java/com/alipay/sofa/jraft/storage/db/AbstractDB.java