/* ----------------------------------------------------------------------------
 * This file was automatically generated by SWIG (http://www.swig.org).
 * Version 1.3.35
 *
 * Do not make changes to this file unless you know what you are doing--modify
 * the SWIG interface file instead.
 * ----------------------------------------------------------------------------- */

package be.portugal.eid;

/******************************************************************************//**
  * This class is used to receive/pass byte arrays
  *********************************************************************************/
public class PTEID_ByteArray extends PTEID_Object {
  private long swigCPtr;

  protected PTEID_ByteArray(long cPtr, boolean cMemoryOwn) {
    super(pteidlibJava_WrapperJNI.SWIGPTEID_ByteArrayUpcast(cPtr), cMemoryOwn);
    swigCPtr = cPtr;
  }

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

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if(swigCPtr != 0 && swigCMemOwn) {
      swigCMemOwn = false;
      pteidlibJava_WrapperJNI.delete_PTEID_ByteArray(swigCPtr);
    }
    swigCPtr = 0;
    super.delete();
  }

	/** Default constructor */
  public PTEID_ByteArray() {
    this(pteidlibJava_WrapperJNI.new_PTEID_ByteArray__SWIG_0(), true);
  }

	/** Copy constructor */
  public PTEID_ByteArray(PTEID_ByteArray bytearray) {
    this(pteidlibJava_WrapperJNI.new_PTEID_ByteArray__SWIG_1(PTEID_ByteArray.getCPtr(bytearray), bytearray), true);
  }

	 /**
	  * Constructor - initialize a byte array with a byte[]
	  *
	  * @param pucData the byte[] input
	  * @param ulSize the size of the input array
	  */
  public PTEID_ByteArray(byte[] pucData, long ulSize) {
    this(pteidlibJava_WrapperJNI.new_PTEID_ByteArray__SWIG_2(pucData, ulSize), true);
  }

	 /**
	  * Append data to the byte array
	  *
	  * @param pucData is the byte array
	  * @param ulSize is the size of the array
	  */
  public void Append(byte[] pucData, long ulSize) {
    pteidlibJava_WrapperJNI.PTEID_ByteArray_Append__SWIG_0(swigCPtr, this, pucData, ulSize);
  }

	 /**
	  * Append data to the byte array
	  */
  public void Append(PTEID_ByteArray data) {
    pteidlibJava_WrapperJNI.PTEID_ByteArray_Append__SWIG_1(swigCPtr, this, PTEID_ByteArray.getCPtr(data), data);
  }

	 /**
	  * clear the contents of the byte array
	  */
  public void Clear() {
    pteidlibJava_WrapperJNI.PTEID_ByteArray_Clear(swigCPtr, this);
  }

	 /**
	  * Return true if the content of the byte array is equal to the content of the byte array passed
	  */
  public boolean Equals(PTEID_ByteArray data) {
    return pteidlibJava_WrapperJNI.PTEID_ByteArray_Equals(swigCPtr, this, PTEID_ByteArray.getCPtr(data), data);
  }

	/** Return the number of bytes in the byte array */
	public long Size() {
    return pteidlibJava_WrapperJNI.PTEID_ByteArray_Size(swigCPtr, this);
  }

 	/**
	  * Return the content of the bytae array as an array of bytes
	  * If Size() == 0, then NULL is returned
	  */
  public byte[] GetBytes() {
	return pteidlibJava_WrapperJNI.PTEID_ByteArray_GetBytes(swigCPtr, this);
	}

	/**
	  * Write the binary content to a file
	  */
  public boolean writeToFile(String csFilePath) {
    return pteidlibJava_WrapperJNI.PTEID_ByteArray_writeToFile(swigCPtr, this, csFilePath);
  }

	/** Copy the content of a given byte array */
	public PTEID_ByteArray assign(PTEID_ByteArray bytearray) {
    return new PTEID_ByteArray(pteidlibJava_WrapperJNI.PTEID_ByteArray_assign(swigCPtr, this, PTEID_ByteArray.getCPtr(bytearray), bytearray), false);
  }

}
