Statistics
| Revision:

root / import / ext3D / trunk / install-extension3d / IzPack / src / lib / net / n3 / nanoxml / IXMLReader.java @ 15280

History | View | Annotate | Download (4.3 KB)

1
/* IXMLReader.java                                                 NanoXML/Java
2
 *
3
 * $Revision: 1.1 $
4
 * $Date: 2006/06/14 07:29:07 $
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

    
32
import java.io.FileNotFoundException;
33
import java.io.IOException;
34
import java.io.Reader;
35
import java.net.MalformedURLException;
36

    
37

    
38
/**
39
 * IXMLReader reads the data to be parsed.
40
 *
41
 * @author Marc De Scheemaecker
42
 * @version $Name:  $, $Revision: 1.1 $
43
 */
44
public interface IXMLReader
45
{
46

    
47
    /**
48
     * Reads a character.
49
     *
50
     * @return the character
51
     *
52
     * @throws java.io.IOException
53
     *                if no character could be read
54
     */
55
    public char read()
56
        throws IOException;
57
        
58
    
59
    /**
60
     * Returns true if the current stream has no more characters left to be
61
     * read.
62
     *
63
     * @throws java.io.IOException
64
     *                if an I/O error occurred
65
     */
66
    public boolean atEOFOfCurrentStream()
67
        throws IOException;
68
        
69
        
70
    /**
71
     * Returns true if there are no more characters left to be read.
72
     *
73
     * @throws java.io.IOException
74
     *                if an I/O error occurred
75
     */
76
    public boolean atEOF()
77
        throws IOException;
78
        
79
    
80
    /**
81
     * Pushes the last character read back to the stream.
82
     *
83
     * @param ch the character to push back
84
     *
85
     * @throws java.io.IOException
86
     *                if an I/O error occurred
87
     */
88
    public void unread(char ch)
89
        throws IOException;
90
        
91

    
92
    /**
93
     * Returns the line number of the data in the current stream.
94
     */
95
    public int getLineNr();
96

    
97

    
98
    /**
99
     * Opens a stream from a public and system ID.
100
     *
101
     * @param publicID the public ID, which may be null
102
     * @param systemID the system ID, which is never null
103
     *
104
     * @throws java.net.MalformedURLException
105
     *     if the system ID does not contain a valid URL
106
     * @throws java.io.FileNotFoundException
107
     *     if the system ID refers to a local file which does not exist
108
     * @throws java.io.IOException
109
     *     if an error occurred opening the stream
110
     */
111
    public Reader openStream(String publicID,
112
                             String systemID)
113
        throws MalformedURLException,
114
               FileNotFoundException,
115
               IOException;
116

    
117

    
118
    /**
119
     * Starts a new stream from a Java reader. The new stream is used
120
     * temporary to read data from. If that stream is exhausted, control
121
     * returns to the parent stream.
122
     *
123
     * @param reader the reader to read the new data from
124
     */
125
    public void startNewStream(Reader reader);
126
    
127
    
128
    /**
129
     * Sets the system ID of the current stream.
130
     *
131
     * @param systemID the system ID
132
     *
133
     * @throws java.net.MalformedURLException
134
     *     if the system ID does not contain a valid URL
135
     */
136
    public void setSystemID(String systemID)
137
        throws MalformedURLException;
138
    
139
    
140
    /**
141
     * Sets the public ID of the current stream.
142
     *
143
     * @param publicID the public ID
144
     */
145
    public void setPublicID(String publicID);
146
    
147
    
148
    /**
149
     * Returns the current system ID.
150
     */
151
    public String getSystemID();    
152
    
153
    
154
    /**
155
     * Returns the current public ID.
156
     */
157
    public String getPublicID();
158
    
159
}