2
* This file is a contribution to the the ContentServer project, mainly for research purposes.
4
* Copyright 2009, Christian Mahnke<cmahnke@gmail.com>.
6
* Licensed under the Apache License, Version 2.0 (the “License”);
7
* you may not use this file except in compliance with the License.
8
* You may obtain a copy of the License at
10
* http://www.apache.org/licenses/LICENSE-2.0
12
* Unless required by applicable law or agreed to in writing, software
13
* distributed under the License is distributed on an “AS IS” BASIS,
14
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
* See the License for the specific language governing permissions and
16
* limitations under the License.
19
package de.unigoettingen.sub.commons.util.datasource;
21
import java.io.IOException;
22
import java.util.Iterator;
23
import java.util.NoSuchElementException;
25
//Avoid logger as external dependency here, try to wrap System.out.* streams
26
//import org.apache.log4j.Logger;
28
public class ImageSourceIterator implements Iterator<Image>, Iterable<Image> {
29
//protected static Logger logger = Logger.getLogger(ImageSourceIterator.class);
31
ImageSource is = null;
35
* Instantiates a new image source iterator.
37
* @param is the ImageSource
39
public ImageSourceIterator(ImageSource is) {
44
* @see java.util.Iterator#hasNext()
46
public boolean hasNext() {
47
if (pageNr < is.getNumberOfPages()) {
54
* @see java.util.Iterator#next()
59
throw new NoSuchElementException();
63
return is.getImage(pageNr);
64
} catch (IOException e) {
71
* @see java.util.Iterator#remove()
73
public void remove() {
74
throw new UnsupportedOperationException();
78
* @see java.lang.Iterable#iterator()
80
public Iterator<Image> iterator() {