org.apache.xml.resolver.readers

Class TextCatalogReader

public class TextCatalogReader extends Object implements CatalogReader

Parses plain text Catalog files.

This class reads plain text Open Catalog files.

Version: 1.0

Author: Norman Walsh Norman.Walsh@Sun.COM

See Also:

Field Summary
protected booleancaseSensitive
Are keywords in the catalog case sensitive?
protected InputStreamcatfile
The input stream used to read the catalog
protected int[]stack
Character lookahead stack.
protected StacktokenStack
Token stack.
protected inttop
The current position on the lookahead stack
Constructor Summary
TextCatalogReader()
Construct a CatalogReader object.
Method Summary
protected voidfinalize()
The destructor.
booleangetCaseSensitive()
protected intnextChar()
Return the next logical character from the input stream.
protected StringnextToken()
Return the next token in the catalog file.
voidreadCatalog(Catalog catalog, String fileUrl)
Start parsing a text catalog file.
voidreadCatalog(Catalog catalog, InputStream is)
voidsetCaseSensitive(boolean isCaseSensitive)

Field Detail

caseSensitive

protected boolean caseSensitive
Are keywords in the catalog case sensitive?

catfile

protected InputStream catfile
The input stream used to read the catalog

stack

protected int[] stack
Character lookahead stack. Reading a catalog sometimes requires up to two characters of lookahead.

tokenStack

protected Stack tokenStack
Token stack. Recognizing an unexpected catalog entry requires the ability to "push back" a token.

top

protected int top
The current position on the lookahead stack

Constructor Detail

TextCatalogReader

public TextCatalogReader()
Construct a CatalogReader object.

Method Detail

finalize

protected void finalize()
The destructor.

Makes sure the catalog file is closed.

getCaseSensitive

public boolean getCaseSensitive()

nextChar

protected int nextChar()
Return the next logical character from the input stream.

Returns: The next (logical) character from the input stream. The character may be buffered from a previous lookahead.

Throws: IOException If an error occurs reading from the stream.

nextToken

protected String nextToken()
Return the next token in the catalog file.

FYI: This code does not throw any sort of exception for a file that contains an n

Returns: The Catalog file token from the input stream.

Throws: IOException If an error occurs reading from the stream.

readCatalog

public void readCatalog(Catalog catalog, String fileUrl)
Start parsing a text catalog file. The file is actually read and parsed as needed by nextEntry.

Parameters: fileUrl The URL or filename of the catalog file to process

Throws: MalformedURLException Improper fileUrl IOException Error reading catalog file

readCatalog

public void readCatalog(Catalog catalog, InputStream is)

setCaseSensitive

public void setCaseSensitive(boolean isCaseSensitive)
Copyright B) 2001-2003 Apache Software Foundation. All Rights Reserved.