1 package no.motif.iter.boxing; 2 3 import java.io.Serializable; 4 import java.util.Iterator; 5 6 import no.motif.iter.PreIndexedContentIterator; 7 8 public final class BytesIterable implements Iterable<Byte>, Serializable { 9 10 private final byte[] bytes; 11 12 public BytesIterable(byte[] bytes) { this.bytes = bytes; } 13 14 @Override 15 public final Iterator<Byte> iterator() { 16 return new PreIndexedContentIterator<Byte>(bytes.length) { 17 @Override protected Byte elementAt(int index) { return bytes[index]; }}; 18 } 19 20 }