1 17 package org.apache.commons.collections.primitives.decorators; 18 19 import org.apache.commons.collections.primitives.ByteListIterator; 20 21 28 public final class UnmodifiableByteListIterator extends ProxyByteListIterator { 29 UnmodifiableByteListIterator(ByteListIterator iterator) { 30 this.proxied = iterator; 31 } 32 33 public void remove() { 34 throw new UnsupportedOperationException ("This ByteListIterator is not modifiable."); 35 } 36 37 public void add(byte value) { 38 throw new UnsupportedOperationException ("This ByteListIterator is not modifiable."); 39 } 40 41 public void set(byte value) { 42 throw new UnsupportedOperationException ("This ByteListIterator is not modifiable."); 43 } 44 45 protected ByteListIterator getListIterator() { 46 return proxied; 47 } 48 49 50 public static final ByteListIterator wrap(ByteListIterator iterator) { 51 if(null == iterator) { 52 return null; 53 } else if(iterator instanceof UnmodifiableByteListIterator) { 54 return iterator; 55 } else { 56 return new UnmodifiableByteListIterator(iterator); 57 } 58 } 59 60 private ByteListIterator proxied = null; 61 } 62 | Popular Tags |