|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.n3.nanoxml.StdXMLReader
public class StdXMLReader
StdXMLReader reads the data to be parsed.
| Constructor Summary | |
|---|---|
StdXMLReader(InputStream stream)
Initializes the XML reader. |
|
StdXMLReader(Reader reader)
Initializes the XML reader. |
|
StdXMLReader(String publicID,
String systemID)
Initializes the reader from a system and public ID. |
|
| Method Summary | |
|---|---|
boolean |
atEOF()
Returns true if there are no more characters left to be read. |
boolean |
atEOFOfCurrentStream()
Returns true if the current stream has no more characters left to be read. |
static IXMLReader |
fileReader(String filename)
Creates a new reader using a file as input. |
protected void |
finalize()
Cleans up the object when it's destroyed. |
protected String |
getEncoding(String str)
Scans the encoding from an <?xml...?> tag. |
int |
getLineNr()
Returns the line number of the data in the current stream. |
String |
getPublicID()
Returns the current public ID. |
int |
getStreamLevel()
Returns the current "level" of the stream on the stack of streams. |
String |
getSystemID()
Returns the current system ID. |
Reader |
openStream(String publicID,
String systemID)
Opens a stream from a public and system ID. |
char |
read()
Reads a character. |
void |
setPublicID(String publicID)
Sets the public ID of the current stream. |
void |
setSystemID(String systemID)
Sets the system ID of the current stream. |
void |
startNewStream(Reader reader)
Starts a new stream from a Java reader. |
void |
startNewStream(Reader reader,
boolean isInternalEntity)
Starts a new stream from a Java reader. |
protected Reader |
stream2reader(InputStream stream,
StringBuffer charsRead)
Converts a stream to a reader while detecting the encoding. |
static IXMLReader |
stringReader(String str)
Creates a new reader using a string as input. |
void |
unread(char ch)
Pushes the last character read back to the stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public StdXMLReader(String publicID,
String systemID)
throws MalformedURLException,
FileNotFoundException,
IOException
publicID - the public ID which may be null.systemID - the non-null system ID.
MalformedURLException - if the system ID does not contain a valid URL
FileNotFoundException - if the system ID refers to a local file which does not exist
IOException - if an error occurred opening the streampublic StdXMLReader(Reader reader)
reader - the input for the XML data.
public StdXMLReader(InputStream stream)
throws IOException
stream - the input for the XML data.
IOException - if an I/O error occurred| Method Detail |
|---|
public static IXMLReader stringReader(String str)
str - the string containing the XML data
public static IXMLReader fileReader(String filename)
throws FileNotFoundException,
IOException
filename - the name of the file containing the XML data
FileNotFoundException - if the file could not be found
IOException - if an I/O error occurred
protected void finalize()
throws Throwable
finalize in class ObjectThrowableprotected String getEncoding(String str)
str - the first tag in the XML data.
protected Reader stream2reader(InputStream stream,
StringBuffer charsRead)
throws IOException
stream - the input for the XML data.charsRead - buffer where to put characters that have been read
IOException - if an I/O error occurred
public char read()
throws IOException
read in interface IXMLReaderIOException - if no character could be read
public boolean atEOFOfCurrentStream()
throws IOException
atEOFOfCurrentStream in interface IXMLReaderIOException - if an I/O error occurred
public boolean atEOF()
throws IOException
atEOF in interface IXMLReaderIOException - if an I/O error occurred
public void unread(char ch)
throws IOException
unread in interface IXMLReaderch - the character to push back.
IOException - if an I/O error occurred
public Reader openStream(String publicID,
String systemID)
throws MalformedURLException,
FileNotFoundException,
IOException
openStream in interface IXMLReaderpublicID - the public ID, which may be nullsystemID - the system ID, which is never null
MalformedURLException - if the system ID does not contain a valid URL
FileNotFoundException - if the system ID refers to a local file which does not exist
IOException - if an error occurred opening the streampublic void startNewStream(Reader reader)
startNewStream in interface IXMLReaderreader - the non-null reader to read the new data from
public void startNewStream(Reader reader,
boolean isInternalEntity)
startNewStream in interface IXMLReaderreader - the non-null reader to read the new data fromisInternalEntity - true if the reader is produced by resolving
an internal entitypublic int getStreamLevel()
getStreamLevel in interface IXMLReaderpublic int getLineNr()
getLineNr in interface IXMLReader
public void setSystemID(String systemID)
throws MalformedURLException
setSystemID in interface IXMLReadersystemID - the system ID
MalformedURLException - if the system ID does not contain a valid URLpublic void setPublicID(String publicID)
setPublicID in interface IXMLReaderpublicID - the public IDpublic String getSystemID()
getSystemID in interface IXMLReaderpublic String getPublicID()
getPublicID in interface IXMLReader
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||