lcio/src/java/hep/lcio/implementation/sio
diff -u -r1.2 -r1.3
--- SIOLCRandomAccessReader.java 22 Jun 2010 13:49:56 -0000 1.2
+++ SIOLCRandomAccessReader.java 30 Jun 2010 00:10:48 -0000 1.3
@@ -26,17 +26,19 @@
public void open(String filename) throws IOException {
super.open(filename);
// Peek at the last record to see if this file supports random access
- try {
- //FIXME: Should not hardwire record length
- SIORecord record = reader.readRecord( - RandomAccessBlock.LCRANDOMACCESSRECORDSIZE );
- if ("LCIORandomAccess".equals(record.getRecordName())) {
- randomAccess = new FileRandomAccessSupport(reader, record);
- }
- reader.seek(0);
- } catch (IOException x) {
- // OK, just assume random access is not supported
+ if (reader.isRandomAccess()) {
+ try {
+ //FIXME: Should not hardwire record length
+ SIORecord record = reader.readRecord( - RandomAccessBlock.LCRANDOMACCESSRECORDSIZE );
+ if ("LCIORandomAccess".equals(record.getRecordName())) {
+ randomAccess = new FileRandomAccessSupport(reader, record);
+ }
+ } catch (IOException x) {
+ // OK, just assume random access is not supported
+ } finally {
+ reader.seek(0);
+ }
}
-
}
@Override