Method: Bio::MAF::ThreadedChunkReaderWrapper#read_chunk

Defined in:
lib/bio/maf/parser.rb

#read_chunkObject



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/bio/maf/parser.rb', line 134

def read_chunk
  if ! @first_seq_read
    # this is the first read_chunk call to read the header
    # not necessarily indicative of sequential access
    @first_seq_read = true
    chunk = cr.read_chunk
    @pos = cr.pos
    return chunk
  elsif @read_ahead_ex
    raise @read_ahead_ex
  elsif @eof_reached
    return nil
  else
    start_read_ahead if @read_thread.nil?
    e = @buffer.take
    case
    when e == :eof
      @eof_reached = nil
      return nil
    when e.is_a?(Exception)
      raise e
    else
      c_pos, chunk = e
      @pos = c_pos
      return chunk
    end
  end
end