KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > n3 > nanoxml > IXMLReader


1 /* IXMLReader.java NanoXML/Java
2  *
3  * $Revision: 1421 $
4  * $Date: 2006-03-12 17:32:32 +0100 (Sun, 12 Mar 2006) $
5  * $Name$
6  *
7  * This file is part of NanoXML 2 for Java.
8  * Copyright (C) 2001 Marc De Scheemaecker, All Rights Reserved.
9  *
10  * This software is provided 'as-is', without any express or implied warranty.
11  * In no event will the authors be held liable for any damages arising from the
12  * use of this software.
13  *
14  * Permission is granted to anyone to use this software for any purpose,
15  * including commercial applications, and to alter it and redistribute it
16  * freely, subject to the following restrictions:
17  *
18  * 1. The origin of this software must not be misrepresented; you must not
19  * claim that you wrote the original software. If you use this software in
20  * a product, an acknowledgment in the product documentation would be
21  * appreciated but is not required.
22  *
23  * 2. Altered source versions must be plainly marked as such, and must not be
24  * misrepresented as being the original software.
25  *
26  * 3. This notice may not be removed or altered from any source distribution.
27  */

28
29 package net.n3.nanoxml;
30
31 import java.io.FileNotFoundException JavaDoc;
32 import java.io.IOException JavaDoc;
33 import java.io.Reader JavaDoc;
34 import java.net.MalformedURLException JavaDoc;
35
36 /**
37  * IXMLReader reads the data to be parsed.
38  *
39  * @author Marc De Scheemaecker
40  * @version $Name$, $Revision: 1421 $
41  */

42 public interface IXMLReader
43 {
44
45     /**
46      * Reads a character.
47      *
48      * @return the character
49      *
50      * @throws java.io.IOException if no character could be read
51      */

52     public char read() throws IOException JavaDoc;
53
54     /**
55      * Returns true if the current stream has no more characters left to be read.
56      *
57      * @throws java.io.IOException if an I/O error occurred
58      */

59     public boolean atEOFOfCurrentStream() throws IOException JavaDoc;
60
61     /**
62      * Returns true if there are no more characters left to be read.
63      *
64      * @throws java.io.IOException if an I/O error occurred
65      */

66     public boolean atEOF() throws IOException JavaDoc;
67
68     /**
69      * Pushes the last character read back to the stream.
70      *
71      * @param ch the character to push back
72      *
73      * @throws java.io.IOException if an I/O error occurred
74      */

75     public void unread(char ch) throws IOException JavaDoc;
76
77     /**
78      * Returns the line number of the data in the current stream.
79      */

80     public int getLineNr();
81
82     /**
83      * Opens a stream from a public and system ID.
84      *
85      * @param publicID the public ID, which may be null
86      * @param systemID the system ID, which is never null
87      *
88      * @throws java.net.MalformedURLException if the system ID does not contain a valid URL
89      * @throws java.io.FileNotFoundException if the system ID refers to a local file which does not
90      * exist
91      * @throws java.io.IOException if an error occurred opening the stream
92      */

93     public Reader JavaDoc openStream(String JavaDoc publicID, String JavaDoc systemID) throws MalformedURLException JavaDoc,
94             FileNotFoundException JavaDoc, IOException JavaDoc;
95
96     /**
97      * Starts a new stream from a Java reader. The new stream is used temporary to read data from.
98      * If that stream is exhausted, control returns to the parent stream.
99      *
100      * @param reader the reader to read the new data from
101      */

102     public void startNewStream(Reader JavaDoc reader);
103
104     /**
105      * Sets the system ID of the current stream.
106      *
107      * @param systemID the system ID
108      *
109      * @throws java.net.MalformedURLException if the system ID does not contain a valid URL
110      */

111     public void setSystemID(String JavaDoc systemID) throws MalformedURLException JavaDoc;
112
113     /**
114      * Sets the public ID of the current stream.
115      *
116      * @param publicID the public ID
117      */

118     public void setPublicID(String JavaDoc publicID);
119
120     /**
121      * Returns the current system ID.
122      */

123     public String JavaDoc getSystemID();
124
125     /**
126      * Returns the current public ID.
127      */

128     public String JavaDoc getPublicID();
129
130 }
131
Popular Tags