FileDocCategorySizeDatePackage
ByteListImpl.javaAPI DocJava SE 6 API2728Tue Jun 10 00:22:42 BST 2008com.sun.org.apache.xerces.internal.impl.dv.util

ByteListImpl

public class ByteListImpl extends Object implements ByteList
Implementation of com.sun.org.apache.xerces.internal.xs.datatypes.ByteList.
xerces.internal
author
Ankit Pasricha, IBM
version
$Id: ByteListImpl.java,v 1.2.6.1 2005/09/06 11:44:40 neerajbj Exp $

Fields Summary
protected final byte[]
data
protected String
canonical
Constructors Summary
public ByteListImpl(byte[] data)

        this.data = data;
    
Methods Summary
public booleancontains(byte item)
Checks if the byte item is a member of this list.

param
item byte whose presence in this list is to be tested.
return
True if this list contains the byte item.

        for (int i = 0; i < data.length; ++i) {
            if (data[i] == item) {
                return true;
            }
        }
        return false;
    
public intgetLength()
The number of bytes in the list. The range of valid child object indices is 0 to length-1 inclusive.

        return data.length;
    
public byteitem(int index)
Returns the indexth item in the collection. The index starts at 0.

param
index index into the collection.
return
The byte at the indexth position in the ByteList.
exception
XSException INDEX_SIZE_ERR: if index is greater than or equal to the number of objects in the list.

        
        if(index < 0 || index > data.length - 1) {
            throw new XSException(XSException.INDEX_SIZE_ERR, null);
        }
        return data[index];