public IEnumerable <IBedRecord> EnumRows(TableDataSetProperties props) { int page = 0; do { while (page < m_directory.Count) { lock (m_directory) { BinaryReader br = new BinaryReader(m_cache); m_cache.Seek(m_directory[page], SeekOrigin.Begin); ChunkInfo info = ChunkInfo.LoadInfo(br); for (int i = 0; i < info.Count; i++) { yield return(BedTool.LoadRecord(br, m_table)); } } page++; } if (State == TabularDataViewState.Loading) { System.Threading.Thread.Sleep(100); } } while (State == TabularDataViewState.Loading); }
private void DoRead(IDataQueue queue) { try { int page = 0; do { while (page < m_directory.Count) { lock (m_directory) { BinaryReader br = new BinaryReader(m_cache); m_cache.Seek(m_directory[page], SeekOrigin.Begin); ChunkInfo info = ChunkInfo.LoadInfo(br); for (int i = 0; i < info.Count; i++) { queue.PutRecord(BedTool.LoadRecord(br, m_table)); } } page++; } if (State == TabularDataViewState.Loading) { System.Threading.Thread.Sleep(100); } } while (State == TabularDataViewState.Loading); queue.PutEof(); } finally { queue.CloseWriting(); } }
public BedTable LoadTableData(TablePageProperties props) { lock (m_directory) { BedTable table = new BedTable(m_table); int start = 0; int count = m_serializedRows; if (props.Count != null) { count = props.Count.Value; } if (props.Start != null) { start = props.Start.Value; } if (start >= m_serializedRows) { return(table); } int curdic = start / BUFFER_SIZE, skiprec = start % BUFFER_SIZE; Errors.Assert(curdic < m_directory.Count); m_cache.Seek(m_directory[curdic], SeekOrigin.Begin); int availtables = m_directory.Count - curdic; BinaryReader br = new BinaryReader(m_cache); while (table.Rows.Count < count && availtables >= 1) { ChunkInfo info = ChunkInfo.LoadInfo(br); if (skiprec > 0) { int skipbytes = 0; for (int i = 0; i < skiprec; i++) { skipbytes += info.Lengths[i]; } m_cache.Seek(skipbytes, SeekOrigin.Current); } int rec = skiprec; while (rec < info.Count) { table.AddRowInternal(BedTool.LoadRecord(br, m_table)); rec++; } availtables--; skiprec = 0; } return(table); } }