hep.graphics.heprep
Interface HepRepReader


public interface HepRepReader

HepRepReader interface.

Author:
Mark Donszelmann

Method Summary
 void close()
          Closes the reader and its underlying stream.
 String entryName()
          Returns the current entry name (random acces only).
 List entryNames()
          Returns a list of names of available entries (random rccess only).
 String getProperty(String key, String defaultValue)
          Returns a property (if set in the heprep.properties file).
 boolean hasNext()
          Is there a next heprep.
 boolean hasRandomAccess()
          Allows random access.
 boolean hasSequentialAccess()
          Allows for sequential access.
 HepRep next()
          Reads the next HepRep from the Reader.
 HepRep read(String name)
          Reads a HepRep by name (random access only).
 void reset()
          Resets a sequential HepRep reader.
 int size()
          Returns the (estimated) number of HepReps in the reader.
 int skip(int n)
          Skips a number of HepReps in the reader.
 

Method Detail

getProperty

String getProperty(String key,
                   String defaultValue)
                   throws IOException
Returns a property (if set in the heprep.properties file).

Parameters:
key - property name
defaultValue - value if property not found
Returns:
property string
Throws:
IOException - in case of a stream problem.

close

void close()
           throws IOException
Closes the reader and its underlying stream.

Throws:
IOException - in case of a stream problem.

hasRandomAccess

boolean hasRandomAccess()
                        throws IOException
Allows random access.

Returns:
true if this reader provides random access
Throws:
IOException - in case of a stream problem.

read

HepRep read(String name)
            throws IOException,
                   UnsupportedOperationException,
                   NoSuchElementException
Reads a HepRep by name (random access only).

Parameters:
name - for the heprep to be read.
Returns:
heprep.
Throws:
IOException - in case of a stream problem.
UnsupportedOperationException - if the reader does not support random access.
NoSuchElementException - if the heprep is not available.

entryName

String entryName()
Returns the current entry name (random acces only).

Returns:
name of the current entry or null if not supported.

entryNames

List entryNames()
Returns a list of names of available entries (random rccess only). Zip files may contain instructions to skip a number of files. These files will not be included in the entries.

Returns:
list of entrynames or null if not supported.

hasSequentialAccess

boolean hasSequentialAccess()
                            throws IOException
Allows for sequential access.

Returns:
true if sequential access is possible.
Throws:
IOException - in case of a stream problem.

reset

void reset()
           throws IOException,
                  UnsupportedOperationException
Resets a sequential HepRep reader.

Throws:
IOException - in case of a stream problem.
UnsupportedOperationException - if the reader does not support sequential access.

size

int size()
Returns the (estimated) number of HepReps in the reader. Zip files may contain instructions to skip a number of files. These files will not be included in the estimate.

Returns:
number of HepReps, or -1 if cannot be calculated.

skip

int skip(int n)
         throws UnsupportedOperationException
Skips a number of HepReps in the reader. Zip files may contain instructions to skip a number of files. These files will not be included in the count to be skipped.

Parameters:
n - number of HepReps to be skipped.
Returns:
number of HepReps skipped.
Throws:
UnsupportedOperationException - if the reader does not support sequential access.

hasNext

boolean hasNext()
                throws IOException,
                       UnsupportedOperationException
Is there a next heprep.

Returns:
true if the next heprep is available.
Throws:
UnsupportedOperationException - if the reader does not support sequential access.
IOException - in case of a stream problem.

next

HepRep next()
            throws IOException,
                   UnsupportedOperationException,
                   NoSuchElementException
Reads the next HepRep from the Reader.

Returns:
heprep.
Throws:
IOException - in case of a stream problem.
UnsupportedOperationException - if the reader does not support sequential access.
NoSuchElementException - if the heprep is not available, or EOF.


Copyright © 2000-2007 FreeHEP. All Rights Reserved.