Package org.apache.xml.resolver.readers
Class TextCatalogReader
java.lang.Object
org.apache.xml.resolver.readers.TextCatalogReader
- All Implemented Interfaces:
CatalogReader
- Direct Known Subclasses:
TR9401CatalogReader
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
FieldsModifier and TypeFieldDescriptionprotected booleanAre keywords in the catalog case sensitive?protected InputStreamThe input stream used to read the catalogprotected int[]Character lookahead stack.protected StackToken stack.protected intThe current position on the lookahead stack -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidfinalize()The destructor.booleanprotected intnextChar()Return the next logical character from the input stream.protected StringReturn the next token in the catalog file.voidreadCatalog(Catalog catalog, InputStream is) Read a catalog from an input stream.voidreadCatalog(Catalog catalog, String fileUrl) Start parsing a text catalog file.voidsetCaseSensitive(boolean isCaseSensitive)
-
Field Details
-
catfile
The input stream used to read the catalog -
stack
protected int[] stackCharacter lookahead stack. Reading a catalog sometimes requires up to two characters of lookahead. -
tokenStack
Token stack. Recognizing an unexpected catalog entry requires the ability to "push back" a token. -
top
protected int topThe current position on the lookahead stack -
caseSensitive
protected boolean caseSensitiveAre keywords in the catalog case sensitive?
-
-
Constructor Details
-
TextCatalogReader
public TextCatalogReader()Construct a CatalogReader object.
-
-
Method Details
-
setCaseSensitive
public void setCaseSensitive(boolean isCaseSensitive) -
getCaseSensitive
public boolean getCaseSensitive() -
readCatalog
Start parsing a text catalog file. The file is actually read and parsed as needed bynextEntry.- Specified by:
readCatalogin interfaceCatalogReader- Parameters:
fileUrl- The URL or filename of the catalog file to processcatalog- The catalog for which this reader is called.- Throws:
MalformedURLException- Improper fileUrlIOException- Error reading catalog file
-
readCatalog
Description copied from interface:CatalogReaderRead a catalog from an input stream.This class reads a catalog from an input stream.
- Specified by:
readCatalogin interfaceCatalogReader- Parameters:
catalog- The catalog for which this reader is called.is- The input stream that is to be read.- Throws:
IOException- if the URL cannot be read.MalformedURLException
-
finalize
protected void finalize()The destructor.Makes sure the catalog file is closed.
-
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.CatalogException
-
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.
-