Documentation of 'org.freehep.util.io.XMLSequence' Java class
XMLSequence
org.freehep.util.io

Class XMLSequence

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable


    public class XMLSequence
    extends java.io.InputStream
    The XMLSequence allows parsing by an XML Parser of concatenated XML segments. Each segment needs to start with " XMLSequence sequence = new XMLSequence(new FileInputStream("file.xml")); SAXParserFactory factory = SAXParserFactory.newInstance(); XMLReader xmlReader = factory.newSAXParser().getXMLReader(); while (sequence.hasNext()) { InputStream input = sequence.next(); InputSource source = new InputSource(input); xmlReader.parse(source); input.close(); } sequence.close(); IMPORTANT: inherits from InputStream rather than FilterInputStream so that the correct read(byte[], int, int) method is used.
    • Constructor Summary

      Constructors 
      Constructor and Description
      XMLSequence(java.io.InputStream input)
      Create a XML Sequence.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      void close() 
      boolean hasNext()
      Is another XML segment available.
      void mark(int readLimit) 
      boolean markSupported() 
      java.io.InputStream next()
      Returns the next XML segment.
      int read() 
      void reset() 
      • Methods inherited from class java.io.InputStream

        available, read, read, skip
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XMLSequence

        public XMLSequence(java.io.InputStream input)
        Create a XML Sequence.
        Parameters:
        input - stream to read from
    • Method Detail

      • hasNext

        public boolean hasNext()
        Is another XML segment available.
        Returns:
        true if another XML segment can be read
      • next

        public java.io.InputStream next()
                                 throws java.io.IOException
        Returns the next XML segment.
        Returns:
        stream to read next XML segment from.
        Throws:
        java.io.IOException - if read fails
      • read

        public int read()
                 throws java.io.IOException
        Specified by:
        read in class java.io.InputStream
        Throws:
        java.io.IOException
      • mark

        public void mark(int readLimit)
        Overrides:
        mark in class java.io.InputStream
      • markSupported

        public boolean markSupported()
        Overrides:
        markSupported in class java.io.InputStream
      • reset

        public void reset()
                   throws java.io.IOException
        Overrides:
        reset in class java.io.InputStream
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class java.io.InputStream
        Throws:
        java.io.IOException

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.