1 17 package org.apache.commons.collections.primitives.decorators; 18 19 import org.apache.commons.collections.primitives.ByteIterator; 20 21 28 public final class UnmodifiableByteIterator extends ProxyByteIterator { 29 UnmodifiableByteIterator(ByteIterator iterator) { 30 this.proxied = iterator; 31 } 32 33 public void remove() { 34 throw new UnsupportedOperationException ("This ByteIterator is not modifiable."); 35 } 36 37 protected ByteIterator getIterator() { 38 return proxied; 39 } 40 41 public static final ByteIterator wrap(ByteIterator iterator) { 42 if(null == iterator) { 43 return null; 44 } else if(iterator instanceof UnmodifiableByteIterator) { 45 return iterator; 46 } else { 47 return new UnmodifiableByteIterator(iterator); 48 } 49 } 50 51 private ByteIterator proxied = null; 52 } 53 | Popular Tags |