FreeHEP API
Version current

hep.graphics.heprep1.xml
Class XMLHepRepReader

java.lang.Object
  extended byhep.graphics.heprep1.xml.XMLHepRepReader
All Implemented Interfaces:
HepRepReader

public class XMLHepRepReader
extends Object
implements HepRepReader

Version:
$Id: XMLHepRepReader.java,v 1.4 2004/08/08 14:37:36 duns Exp $
Author:
M.Donszelmann
Source Code:
XMLHepRepReader.java

Field Summary
protected  InputStream input
           
protected  String name
           
protected  ZipFile zipFile
           
 
Constructor Summary
XMLHepRepReader(InputStream input)
           
XMLHepRepReader(String name)
           
 
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).
 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  HepRep readHepRep(InputStream stream)
           
 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

input

protected InputStream input

name

protected String name

zipFile

protected ZipFile zipFile
Constructor Detail

XMLHepRepReader

public XMLHepRepReader(InputStream input)
                throws IOException

XMLHepRepReader

public XMLHepRepReader(String name)
                throws IOException
Method Detail

readHepRep

protected HepRep readHepRep(InputStream stream)
                     throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Description copied from interface: HepRepReader
Closes the reader and its underlying stream.

Specified by:
close in interface HepRepReader
Throws:
IOException - in case of a stream problem.

hasSequentialAccess

public boolean hasSequentialAccess()
                            throws IOException
Description copied from interface: HepRepReader
Allows for sequential access.

Specified by:
hasSequentialAccess in interface HepRepReader
Returns:
true if sequential access is possible.
Throws:
IOException - in case of a stream problem.

reset

public void reset()
           throws IOException,
                  UnsupportedOperationException
Description copied from interface: HepRepReader
Resets a sequential HepRep reader.

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

size

public int size()
Description copied from interface: HepRepReader
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.

Specified by:
size in interface HepRepReader
Returns:
number of HepReps, or -1 if cannot be calculated.

skip

public int skip(int n)
         throws UnsupportedOperationException
Description copied from interface: HepRepReader
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.

Specified by:
skip in interface HepRepReader
Parameters:
n - number of HepReps to be skipped.
Returns:
number of HepReps skipped.
Throws:
UnsupportedOperationException - if the reader does not support sequential access.

hasNext

public boolean hasNext()
                throws IOException,
                       UnsupportedOperationException
Description copied from interface: HepRepReader
Is there a next heprep.

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

next

public HepRep next()
            throws IOException,
                   UnsupportedOperationException,
                   NoSuchElementException
Description copied from interface: HepRepReader
Reads the next HepRep from the Reader.

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

hasRandomAccess

public boolean hasRandomAccess()
Description copied from interface: HepRepReader
Allows random access.

Specified by:
hasRandomAccess in interface HepRepReader
Returns:
true if this reader provides random access

read

public HepRep read(String name)
            throws IOException,
                   UnsupportedOperationException,
                   NoSuchElementException
Description copied from interface: HepRepReader
Reads a HepRep by name (random access only).

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

entryName

public String entryName()
Description copied from interface: HepRepReader
Returns the current entry name (random acces only).

Specified by:
entryName in interface HepRepReader
Returns:
name of the current entry or null if not supported.

entryNames

public List entryNames()
Description copied from interface: HepRepReader
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.

Specified by:
entryNames in interface HepRepReader
Returns:
list of entrynames or null if not supported.

FreeHEP API
Version current

Copyright © 2000-2004 FreeHEP, All Rights Reserved.