1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2009 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
7
|
* The contents of this file are subject to the Mozilla Public License Version 1.1
|
8
|
* See LICENSE.TXT at the top of this package for the full license terms.
|
9
|
*/
|
10
|
package eu.etaxonomy.cdm.io.markup;
|
11
|
|
12
|
import javax.xml.stream.XMLEventReader;
|
13
|
import javax.xml.stream.XMLStreamException;
|
14
|
import javax.xml.stream.events.XMLEvent;
|
15
|
|
16
|
import org.apache.log4j.Logger;
|
17
|
|
18
|
/**
|
19
|
* @author a.mueller
|
20
|
* @date 28.06.2011
|
21
|
*
|
22
|
*/
|
23
|
public class LookAheadEventReader implements XMLEventReader {
|
24
|
@SuppressWarnings("unused")
|
25
|
private static final Logger logger = Logger.getLogger(LookAheadEventReader.class);
|
26
|
|
27
|
XMLEventReader reader;
|
28
|
|
29
|
/* (non-Javadoc)
|
30
|
* @see java.util.Iterator#next()
|
31
|
*/
|
32
|
@Override
|
33
|
public Object next() {
|
34
|
throw new RuntimeException("Iterator methods are not supported by this EventReader");
|
35
|
}
|
36
|
|
37
|
/* (non-Javadoc)
|
38
|
* @see java.util.Iterator#remove()
|
39
|
*/
|
40
|
@Override
|
41
|
public void remove() {
|
42
|
throw new RuntimeException("Iterator methods are not supported by this EventReader");
|
43
|
}
|
44
|
|
45
|
/* (non-Javadoc)
|
46
|
* @see javax.xml.stream.XMLEventReader#nextEvent()
|
47
|
*/
|
48
|
@Override
|
49
|
public XMLEvent nextEvent() throws XMLStreamException {
|
50
|
return reader.nextEvent();
|
51
|
}
|
52
|
|
53
|
/* (non-Javadoc)
|
54
|
* @see javax.xml.stream.XMLEventReader#hasNext()
|
55
|
*/
|
56
|
@Override
|
57
|
public boolean hasNext() {
|
58
|
return reader.hasNext();
|
59
|
}
|
60
|
|
61
|
/* (non-Javadoc)
|
62
|
* @see javax.xml.stream.XMLEventReader#peek()
|
63
|
*/
|
64
|
@Override
|
65
|
public XMLEvent peek() throws XMLStreamException {
|
66
|
return reader.peek();
|
67
|
}
|
68
|
|
69
|
/* (non-Javadoc)
|
70
|
* @see javax.xml.stream.XMLEventReader#getElementText()
|
71
|
*/
|
72
|
@Override
|
73
|
public String getElementText() throws XMLStreamException {
|
74
|
return reader.getElementText();
|
75
|
}
|
76
|
|
77
|
/* (non-Javadoc)
|
78
|
* @see javax.xml.stream.XMLEventReader#nextTag()
|
79
|
*/
|
80
|
@Override
|
81
|
public XMLEvent nextTag() throws XMLStreamException {
|
82
|
return reader.nextTag();
|
83
|
}
|
84
|
|
85
|
/* (non-Javadoc)
|
86
|
* @see javax.xml.stream.XMLEventReader#getProperty(java.lang.String)
|
87
|
*/
|
88
|
@Override
|
89
|
public Object getProperty(String name) throws IllegalArgumentException {
|
90
|
return reader.getProperty(name);
|
91
|
}
|
92
|
|
93
|
/* (non-Javadoc)
|
94
|
* @see javax.xml.stream.XMLEventReader#close()
|
95
|
*/
|
96
|
@Override
|
97
|
public void close() throws XMLStreamException {
|
98
|
reader.close();
|
99
|
}
|
100
|
|
101
|
}
|