public interface RecordSource
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the record source and release any associated resources.
|
void |
current()
Reloads the current record.
|
long |
getCurrentIndex()
Returns the index of the current record.
|
Object |
getCurrentRecord()
Returns the current record.
|
RecordTag |
getCurrentTag()
Returns the tag of the current record.
|
long |
getEstimatedSize()
Returns the estimated number of records in this source.
|
String |
getName()
Returns the name of this source.
|
Class<?> |
getRecordClass()
Returns the Class object that is guaranteed to be a superclass of all records in this source.
|
List<RecordTag> |
getTags()
Returns a list of tags for events in this source.
|
boolean |
hasCurrent()
Returns true if this source can reload the current record.
|
boolean |
hasIndex(long index)
Returns true if this source has a record with the specified index.
|
boolean |
hasNext()
Returns true if this source can load the next record.
|
boolean |
hasPrevious()
Returns true if this source can load the previous record.
|
boolean |
hasRewind()
Returns true if this source in its current state can be rewound.
|
boolean |
hasShift(long numberOfRecords)
Returns true if this source can shift numberOfRecords records.
|
boolean |
hasTag(RecordTag tag)
Returns true if this source has a record with the specified tag.
|
void |
jump(long index)
Loads the record specified by the index.
|
void |
jump(RecordTag tag)
Loads the record specified by the tag.
|
void |
next()
Loads the next record.
|
RecordTag |
parseTag(String s)
Returns a tag corresponding to the specified string.
|
void |
previous()
Loads the previous record.
|
void |
releaseRecord()
Releases any resources associated with the current record.
|
void |
rewind()
Positions the cursor of this source before the first record.
|
void |
shift(long numberOfRecords)
Loads the record specified by the offset with respect to the current cursor position.
|
long |
size()
Returns the number of records in this source.
|
boolean |
supportsCurrent()
Returns true if this source supports reloading current record.
|
boolean |
supportsIndex()
Returns true if this source supports selecting records by index.
|
boolean |
supportsNext()
Returns true if this source supports loading next record.
|
boolean |
supportsPrevious()
Returns true if this source supports loading previous record.
|
boolean |
supportsRewind()
Returns true if this source supports rewind operation.
|
boolean |
supportsShift()
Returns true if this source supports selecting records by offset with respect to the current record.
|
boolean |
supportsTag()
Returns true if this source supports selecting records by tag.
|
String getName()
Class<?> getRecordClass()
long size()
The number of records returned by this method is guaranteed to be correct when the method is called; however, the size of some RecordSource implementations might change in time.
UnsupportedOperationException
- if the number of records is unknown.long getEstimatedSize()
Clients may use the estimate provided by this method to give the user feedback on what portion of the record source has been read, for example. However, the estimate is not guaranteed to be correct.
UnsupportedOperationException
- if the number of records is unknown.List<RecordTag> getTags()
The list of tags returned by this method is guaranteed to be complete when the method is called; however, the content of some RecordSource implementations might change in time.
UnsupportedOperationException
- if this source does not support access by tag,
or if the list of tags cannot be retrieved.long getCurrentIndex()
IllegalStateException
- if the current index is not known.UnsupportedOperationException
- if this source does not support access by index,RecordTag getCurrentTag()
IllegalStateException
- if there is no current record, or the current tag is not known.UnsupportedOperationException
- if this source does not support access by tag,Object getCurrentRecord() throws IOException
IllegalStateException
- if there is no current record.IOException
- if retrieving the current record fails for any reason.void releaseRecord()
boolean supportsCurrent()
boolean supportsNext()
boolean supportsPrevious()
boolean supportsIndex()
boolean supportsTag()
boolean supportsShift()
boolean hasCurrent()
Some implementations might not be able to figure out whether reloading is possible before trying it, so the fact that this method returns true does not exclude the possibility of NoSuchRecordException being thrown by the next call to current().
boolean hasNext()
Some implementations might not be able to figure out whether loading the next record is possible before trying it, so the fact that this method returns true does not exclude the possibility of NoSuchRecordException being thrown by the next call to next().
boolean hasPrevious()
Some implementations might not be able to figure out whether loading the previous record is possible before trying it, so the fact that this method returns true does not exclude the possibility of NoSuchRecordException being thrown by the next call to previous().
boolean hasIndex(long index)
Some implementations might not be able to figure out whether the requested record exists before trying to load it, so the fact that this method returns true does not exclude the possibility of NoSuchRecordException being thrown by the next call to jump(index).
boolean hasTag(RecordTag tag)
Some implementations might not be able to figure out whether the requested record exists before trying to load it, so the fact that this method returns true does not exclude the possibility of NoSuchRecordException being thrown by the next call to jump(tag).
boolean hasShift(long numberOfRecords)
Some implementations might not be able to figure out whether the requested record exists before trying to load it, so the fact that this method returns true does not exclude the possibility of NoSuchRecordException being thrown by the next call to shift(numberOfRecords).
void current() throws IOException, NoSuchRecordException
NoSuchRecordException
- if there is no current record.IOException
- if reloading of the current record fails.UnsupportedOperationException
- if this source does not support reloading of the current record.void next() throws IOException, NoSuchRecordException
NoSuchRecordException
- if there is no next record.IOException
- if loading of the next record fails.UnsupportedOperationException
- if this source does not support loading the next record.void previous() throws IOException, NoSuchRecordException
NoSuchRecordException
- if there is no previous record.IOException
- if loading of the previous record fails.UnsupportedOperationException
- if this source does not support loading the previous record.void jump(long index) throws IOException, NoSuchRecordException
NoSuchRecordException
- if this source does not have a record with the specified index.IOException
- if loading of the requested record fails.UnsupportedOperationException
- if this source does not support access by index.void jump(RecordTag tag) throws IOException, NoSuchRecordException
NoSuchRecordException
- if this source does not have a record with the specified tag.IOException
- if loading of the requested record fails.UnsupportedOperationException
- if this source does not support access by tag.void shift(long numberOfRecords) throws IOException, NoSuchRecordException
NoSuchRecordException
- if this source does not have a record with the specified offset.IOException
- if loading of the requested record fails.UnsupportedOperationException
- if this source does not support access by offset.boolean supportsRewind()
boolean hasRewind()
void rewind() throws IOException
UnsupportedOperationException
- if this source does not support rewind.IOException
- if rewinding fails for any reason.void close() throws IOException
IOException
- if closing fails.RecordTag parseTag(String s)
IllegalArgumentException
- if the specified string cannot be parsed.Copyright © 2000-2012 FreeHEP. All Rights Reserved.