static class SGMLParser.Buffer extends Object
| Modifier and Type | Field and Description |
|---|---|
private char[] |
bufferArray
The current buffer.
|
private int |
end
|
private int |
newStart
Set by
readArray(eu.simuline.util.sgml.SGMLParser.CharTester) and read by getStartAndMove(). |
private Reader |
reader
The reader buffered.
|
private int |
start
The first index in
bufferArray
read in from reader but not returned
by readArray(eu.simuline.util.sgml.SGMLParser.CharTester) or readChar(). |
| Constructor and Description |
|---|
Buffer(Reader reader,
int length)
Creates a new
Buffer from the given reader
with the given size. |
| Modifier and Type | Method and Description |
|---|---|
(package private) char[] |
getChars()
Returns the buffer of
chars. |
(package private) int |
getEnd()
Get method for
end. |
(package private) int |
getStart()
Get method for
start. |
(package private) int |
getStartAndMove()
|
(package private) boolean |
isEmpty()
Returns whether this buffer is currently empty.
|
(package private) boolean |
reachedEOS()
Returns whether the end of the stream is reached.
|
(package private) int |
readArray(SGMLParser.CharTester charTester)
Reads an array from
reader. |
(package private) int |
readChar()
Reads a single
char and returns it. |
(package private) StringBuffer |
readStringBuffer(SGMLParser.CharTester charTester,
String elementName)
Describe
readStringBuffer method here. |
private final Reader reader
private final char[] bufferArray
private int start
bufferArray
read in from reader but not returned
by readArray(eu.simuline.util.sgml.SGMLParser.CharTester) or readChar().private int newStart
readArray(eu.simuline.util.sgml.SGMLParser.CharTester) and read by getStartAndMove().
When invoking readArray(eu.simuline.util.sgml.SGMLParser.CharTester) newStart
is set to start and increased
by the number of read charactersincreases.
Then getStartAndMove() updates start
according to newStart.private int end
bufferArray not read
from reader
or -1 if the end of the stream is reached.
This means that bufferArray[end]
either does not exist or at least is not significant.Buffer(Reader reader, int length) throws IOException
Buffer from the given reader
with the given size.reader - the Reader to be buffered.length - the length of the buffer.IOException - if an error occursboolean isEmpty()
reader.boolean value
signifying whether this buffer is currently empty.boolean reachedEOS()
boolean specifying
whether the end of the stream is reached.int readChar()
throws IOException
char and returns it.int value
which is either the next char read in
or -1 which signifies the end of the stream.IOException - if an error occursint readArray(SGMLParser.CharTester charTester) throws IOException
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.charTester - a CharTester which signifies
when to end reading from the buffer.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.IOException - if an error occursStringBuffer readStringBuffer(SGMLParser.CharTester charTester, String elementName) throws IOException, SAXParseException
readStringBuffer method here.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
StringBuffer containing characters
starting with the current one until one
charTester returns true.IOException - if an io-error occursSAXParseException - if the parser faces the end of the stream
while scanning the current element.char[] getChars()
chars.char[] bufferArray.int getStartAndMove()
int value of start.Copyright © 2012–2018 Simuline Organization (l2r). All rights reserved.