Class TextCatalogReader
- java.lang.Object
-
- com.sun.org.apache.xml.internal.resolver.readers.TextCatalogReader
-
- All Implemented Interfaces:
CatalogReader
- Direct Known Subclasses:
TR9401CatalogReader
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:
Catalog
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancaseSensitiveAre keywords in the catalog case sensitive?protected InputStreamcatfileThe input stream used to read the catalogprotected int[]stackCharacter lookahead stack.protected StacktokenStackToken stack.protected inttopThe current position on the lookahead stack
-
Constructor Summary
Constructors Constructor Description TextCatalogReader()Construct a CatalogReader object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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, InputStream is)Read a catalog from an input stream.voidreadCatalog(Catalog catalog, String fileUrl)Start parsing a text catalog file.voidsetCaseSensitive(boolean isCaseSensitive)
-
-
-
Field Detail
-
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
-
caseSensitive
protected boolean caseSensitive
Are keywords in the catalog case sensitive?
-
-
Method Detail
-
setCaseSensitive
public void setCaseSensitive(boolean isCaseSensitive)
-
getCaseSensitive
public boolean getCaseSensitive()
-
readCatalog
public void readCatalog(Catalog catalog, String fileUrl) throws MalformedURLException, IOException
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
public void readCatalog(Catalog catalog, InputStream is) throws MalformedURLException, IOException
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
protected String nextToken() throws IOException, CatalogException
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
protected int nextChar() throws IOExceptionReturn 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.
-
-