1 16 package org.apache.xerces.impl.dv.util; 17 18 import org.apache.xerces.xs.datatypes.ByteList; 19 import org.apache.xerces.xs.XSException; 20 21 30 public class ByteListImpl implements ByteList { 31 32 protected final byte[] data; 34 35 protected String canonical; 37 38 public ByteListImpl(byte[] data) { 39 this.data = data; 40 } 41 42 46 public int getLength() { 47 return data.length; 48 } 49 50 58 public boolean contains(byte item) { 59 for (int i = 0; i < data.length; ++i) { 60 if (data[i] == item) { 61 return true; 62 } 63 } 64 return false; 65 } 66 67 77 public byte item(int index) 78 throws XSException { 79 80 if(index < 0 || index > data.length - 1) { 81 throw new XSException(XSException.INDEX_SIZE_ERR, null); 82 } 83 return data[index]; 84 } 85 86 } 87 88 | Popular Tags |