|
FreeHEP API Version current |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object hep.graphics.heprep.ref.AbstractHepRepReader
This abstract HepRep Reader handles ZipInputStreams, ZipFiles, reads the "heprep.properties" file, allows for properties to be quesried and handles files to be skipped while iterating. It assumes the concrete subclass has Sequential access. ZipFiles will provide Random access as well. The reset method should implement the opening of the file(s), or call super.reset(). Reset should be called from the constructor to open the initial file.
Field Summary | |
static String |
cvsId
|
protected InputStream |
input
|
protected String |
name
|
protected ZipFile |
zipFile
|
Constructor Summary | |
protected |
AbstractHepRepReader(InputStream in)
|
protected |
AbstractHepRepReader(String fileName)
|
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). |
protected abstract HepRep |
readHepRep(InputStream input)
|
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String cvsId
protected InputStream input
protected String name
protected ZipFile zipFile
Constructor Detail |
protected AbstractHepRepReader(InputStream in) throws IOException
protected AbstractHepRepReader(String fileName) throws IOException
Method Detail |
public String getProperty(String key, String defaultValue) throws IOException
HepRepReader
getProperty
in interface HepRepReader
key
- property namedefaultValue
- value if property not found
IOException
- in case of a stream problem.public void close() throws IOException
HepRepReader
close
in interface HepRepReader
IOException
- in case of a stream problem.public boolean hasSequentialAccess() throws IOException
HepRepReader
hasSequentialAccess
in interface HepRepReader
IOException
- in case of a stream problem.public void reset() throws IOException, UnsupportedOperationException
HepRepReader
reset
in interface HepRepReader
UnsupportedOperationException
- if the reader does not support sequential access.
IOException
- in case of a stream problem.public int size()
HepRepReader
size
in interface HepRepReader
public int skip(int n) throws UnsupportedOperationException
HepRepReader
skip
in interface HepRepReader
n
- number of HepReps to be skipped.
UnsupportedOperationException
- if the reader does not support sequential access.public boolean hasNext() throws IOException, UnsupportedOperationException
HepRepReader
hasNext
in interface HepRepReader
IOException
- in case of a stream problem.
UnsupportedOperationException
- if the reader does not support sequential access.public HepRep next() throws IOException, UnsupportedOperationException, NoSuchElementException
HepRepReader
next
in interface HepRepReader
NoSuchElementException
- if the heprep is not available, or EOF.
UnsupportedOperationException
- if the reader does not support sequential access.
IOException
- in case of a stream problem.public boolean hasRandomAccess()
HepRepReader
hasRandomAccess
in interface HepRepReader
public HepRep read(String name) throws IOException, UnsupportedOperationException, NoSuchElementException
HepRepReader
read
in interface HepRepReader
name
- for the heprep to be read.
IOException
- in case of a stream problem.
UnsupportedOperationException
- if the reader does not support random access.
NoSuchElementException
- if the heprep is not available.public String entryName()
HepRepReader
entryName
in interface HepRepReader
public List entryNames()
HepRepReader
entryNames
in interface HepRepReader
protected abstract HepRep readHepRep(InputStream input) throws IOException
IOException
|
FreeHEP API Version current |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |