- fIndex = Math.max(fIndex, streamInputReader.getPacketReader()
- .getCurrentPacket().getIndexBegin()
- + offset);
- }
- }
- return hasMoreEvents();
- }
-
- public boolean seekIndex(long index) {
- this.prio.clear();
-
- long tempIndex = Long.MIN_VALUE;
- long tempTimestamp = Long.MIN_VALUE;
- try {
- for (StreamInputReader streamInputReader : this.streamInputReaders) {
- /*
- * Seek the trace reader.
- */
- final long streamIndex = streamInputReader.seekIndex(index);
- if (streamInputReader.getCurrentEvent() != null) {
- tempIndex = Math.max(tempIndex, streamIndex);
- EventDefinition currentEvent = streamInputReader
- .getCurrentEvent();
- /*
- * Maybe we're at the beginning of a trace.
- */
- if (currentEvent == null) {
- streamInputReader.readNextEvent();
- currentEvent = streamInputReader.getCurrentEvent();
- }
- if (currentEvent != null) {
- tempTimestamp = Math.max(tempTimestamp,
- currentEvent.getTimestamp());
- } else {
- /*
- * probably beyond the last event
- */
- tempIndex = goToZero();
- }
- }