package clucene;
public class _CL_p_uint8_tArray {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  protected _CL_p_uint8_tArray(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(_CL_p_uint8_tArray obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      CLjavaJNI.delete__CL_p_uint8_tArray(swigCPtr);
    }
    swigCPtr = 0;
  }

  public _CL_p_uint8_tArray(byte[] val) {
    this(CLjavaJNI.new__CL_p_uint8_tArray(), true);
    
		int size=val.length;
		this.init(size);
		for ( int i=0;i<size;i++ )
			this.set(val[i],i);
  }
  
  public byte[] toArray()
	{
		int len = this.length();
		byte[] ret = new byte[len];
		for ( int i=0;i<len;i++ )
			ret[i]=get(i);
		return ret;
	}

  public int length() {
    return CLjavaJNI._CL_p_uint8_tArray_length(swigCPtr);
  }

  public void init(int len) {
    CLjavaJNI._CL_p_uint8_tArray_init(swigCPtr, len);
  }

  public byte get(int idx) {
    return CLjavaJNI._CL_p_uint8_tArray_get(swigCPtr, idx);
  }

  public void set(byte a, int i) {
    CLjavaJNI._CL_p_uint8_tArray_set(swigCPtr, a, i);
  }

}
