01: /*
02: * Copyright (C) 2005 Joe Walnes.
03: * Copyright (C) 2006, 2007 XStream Committers.
04: * All rights reserved.
05: *
06: * The software in this package is published under the terms of the BSD
07: * style license a copy of which has been included with this distribution in
08: * the LICENSE.txt file.
09: *
10: * Created on 24. April 2005 by Joe Walnes
11: */
12: package com.thoughtworks.xstream.io;
13:
14: import java.util.Iterator;
15:
16: /**
17: * Provide an iterator over the attribute names of the current node of a reader.
18: *
19: * @author Joe Walnes
20: */
21: public class AttributeNameIterator implements Iterator {
22:
23: private int current;
24: private final int count;
25: private final HierarchicalStreamReader reader;
26:
27: public AttributeNameIterator(HierarchicalStreamReader reader) {
28: this .reader = reader;
29: count = reader.getAttributeCount();
30: }
31:
32: public boolean hasNext() {
33: return current < count;
34: }
35:
36: public Object next() {
37: return reader.getAttributeName(current++);
38: }
39:
40: public void remove() {
41: throw new UnsupportedOperationException();
42: }
43:
44: }
|