Class SGMLParser.Buffer

  • Enclosing class:
    SGMLParser

    static class SGMLParser.Buffer
    extends java.lang.Object
    Class which buffers the read stream.
    • Constructor Detail

      • Buffer

        Buffer​(java.io.Reader reader,
               int length)
        throws java.io.IOException
        Creates a new Buffer from the given reader with the given size.
        Parameters:
        reader - the Reader to be buffered.
        length - the length of the buffer.
        Throws:
        java.io.IOException - if an error occurs
    • Method Detail

      • isEmpty

        boolean isEmpty()
        Returns whether this buffer is currently empty. When this is the case and someone tries to read further characters this will lead to a trial to read further pieces from reader.
        Returns:
        a boolean value signifying whether this buffer is currently empty.
      • reachedEOS

        boolean reachedEOS()
        Returns whether the end of the stream is reached.
        Returns:
        a boolean specifying whether the end of the stream is reached.
      • readChar

        int readChar()
              throws java.io.IOException
        Reads a single char and returns it.
        Returns:
        an int value which is either the next char read in or -1 which signifies the end of the stream.
        Throws:
        java.io.IOException - if an error occurs
      • readArray

        int readArray​(SGMLParser.CharTester charTester)
               throws java.io.IOException
        Reads an array from reader. As a side effect, writes the field newStart. Also, if the portion of bufferArray to be read, i.e. between start and end, is empty, a new portion is buffered.
        Parameters:
        charTester - a CharTester which signifies when to end reading from the buffer.
        Returns:
        an int signifying the number of chars read or -1 which signifies the end of the stream. It is read to the next < or, if there is none, to the end of the stream. Thus there is a difference between the return values -1 and 0.
        Throws:
        java.io.IOException - if an error occurs
      • readStringBuffer

        java.lang.StringBuffer readStringBuffer​(SGMLParser.CharTester charTester,
                                                java.lang.String elementName)
                                         throws java.io.IOException,
                                                org.xml.sax.SAXParseException
        Describe readStringBuffer method here.
        Parameters:
        charTester - a CharTester which determines the first character not read into the resulting StringBuffer.
        elementName - a String which determines the element under consideration. This is only used for generating the message of a SAXParseException.

        Allowed values: SGMLParser.START_TAG, SGMLParser.END_TAG, SGMLParser.PROC_INSTR, SGMLParser.ATTR_NAME, SGMLParser.WHITESP_IN_ATTR and SGMLParser.ATTR_VALUE. ****** comment and <!element missing.

        Returns:
        a StringBuffer containing characters starting with the current one until one charTester returns true.
        Throws:
        java.io.IOException - if an io-error occurs
        org.xml.sax.SAXParseException - if the parser faces the end of the stream while scanning the current element.
      • getChars

        char[] getChars()
        Returns the buffer of chars.
        Returns:
        the char[] bufferArray.
      • getStartAndMove

        int getStartAndMove()
        Moves newStart to start and returns the old value of start.
        Returns:
        the old int value of start.
      • getStart

        int getStart()
        Get method for start.
        Returns:
        start
      • getEnd

        int getEnd()
        Get method for end.
        Returns:
        end