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

package com.chilkatsoft;

public class CkByteData {
  private transient long swigCPtr;
  protected transient boolean swigCMemOwn;

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

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

  protected static long swigRelease(CkByteData obj) {
    long ptr = 0;
    if (obj != null) {
      if (!obj.swigCMemOwn)
        throw new RuntimeException("Cannot release ownership as memory is not owned");
      ptr = obj.swigCPtr;
      obj.swigCMemOwn = false;
      obj.delete();
    }
    return ptr;
  }

  @SuppressWarnings({"deprecation", "removal"})
  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        chilkatJNI.delete_CkByteData(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public CkByteData() {
    this(chilkatJNI.new_CkByteData(), true);
  }

  public byte[] toByteArray() {
    return chilkatJNI.CkByteData_toByteArray(swigCPtr, this);
  }

  public void appendByteArray(byte[] arr) {
    chilkatJNI.CkByteData_appendByteArray(swigCPtr, this, arr);
  }

  public String to_s() {
    return chilkatJNI.CkByteData_to_s(swigCPtr, this);
  }

  public void appendRandom(int numBytes) {
    chilkatJNI.CkByteData_appendRandom(swigCPtr, this, numBytes);
  }

  public void appendInt(int v, boolean littleEndian) {
    chilkatJNI.CkByteData_appendInt(swigCPtr, this, v, littleEndian);
  }

  public void appendShort(short v, boolean littleEndian) {
    chilkatJNI.CkByteData_appendShort(swigCPtr, this, v, littleEndian);
  }

  public String getEncodedRange(String encoding, int index, int numBytes) {
    return chilkatJNI.CkByteData_getEncodedRange(swigCPtr, this, encoding, index, numBytes);
  }

  public void appendRange(CkByteData byteData, int index, int numBytes) {
    chilkatJNI.CkByteData_appendRange(swigCPtr, this, CkByteData.getCPtr(byteData), byteData, index, numBytes);
  }

  public void ensureBuffer(int numBytes) {
    chilkatJNI.CkByteData_ensureBuffer(swigCPtr, this, numBytes);
  }

  public int findBytes2(String byteData, int byteDataLen) {
    return chilkatJNI.CkByteData_findBytes2(swigCPtr, this, byteData, byteDataLen);
  }

  public int findBytes(CkByteData byteData) {
    return chilkatJNI.CkByteData_findBytes(swigCPtr, this, CkByteData.getCPtr(byteData), byteData);
  }

  public boolean beginsWith2(String byteData, int byteDataLen) {
    return chilkatJNI.CkByteData_beginsWith2(swigCPtr, this, byteData, byteDataLen);
  }

  public boolean beginsWith(CkByteData byteData) {
    return chilkatJNI.CkByteData_beginsWith(swigCPtr, this, CkByteData.getCPtr(byteData), byteData);
  }

  public void removeChunk(int index, int numBytes) {
    chilkatJNI.CkByteData_removeChunk(swigCPtr, this, index, numBytes);
  }

  public void byteSwap4321() {
    chilkatJNI.CkByteData_byteSwap4321(swigCPtr, this);
  }

  public void pad(int blockSize, int paddingScheme) {
    chilkatJNI.CkByteData_pad(swigCPtr, this, blockSize, paddingScheme);
  }

  public void unpad(int blockSize, int paddingScheme) {
    chilkatJNI.CkByteData_unpad(swigCPtr, this, blockSize, paddingScheme);
  }

  public boolean is7bit() {
    return chilkatJNI.CkByteData_is7bit(swigCPtr, this);
  }

  public void clear() {
    chilkatJNI.CkByteData_clear(swigCPtr, this);
  }

  public int getSize() {
    return chilkatJNI.CkByteData_getSize(swigCPtr, this);
  }

  public void appendEncoded(String str, String encoding) {
    chilkatJNI.CkByteData_appendEncoded(swigCPtr, this, str, encoding);
  }

  public void encode(String encoding, CkString str) {
    chilkatJNI.CkByteData_encode(swigCPtr, this, encoding, CkString.getCPtr(str), str);
  }

  public SWIGTYPE_p_unsigned_char getData() {
    long cPtr = chilkatJNI.CkByteData_getData(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
  }

  public SWIGTYPE_p_unsigned_char getBytes() {
    long cPtr = chilkatJNI.CkByteData_getBytes(swigCPtr, this);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
  }

  public String getEncoded(String encoding) {
    return chilkatJNI.CkByteData_getEncoded(swigCPtr, this, encoding);
  }

  public SWIGTYPE_p_unsigned_char getRange(int index, int numBytes) {
    long cPtr = chilkatJNI.CkByteData_getRange(swigCPtr, this, index, numBytes);
    return (cPtr == 0) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);
  }

  public String getRangeStr(int index, int numAnsiChars) {
    return chilkatJNI.CkByteData_getRangeStr(swigCPtr, this, index, numAnsiChars);
  }

  public void append2(String data, int numBytes) {
    chilkatJNI.CkByteData_append2(swigCPtr, this, data, numBytes);
  }

  public boolean equals2(String data, int numBytes) {
    return chilkatJNI.CkByteData_equals2(swigCPtr, this, data, numBytes);
  }

  public boolean equals(CkByteData db) {
    return chilkatJNI.CkByteData_equals(swigCPtr, this, CkByteData.getCPtr(db), db);
  }

  public void appendStr(String str) {
    chilkatJNI.CkByteData_appendStr(swigCPtr, this, str);
  }

  public void appendChar(char ch) {
    chilkatJNI.CkByteData_appendChar(swigCPtr, this, ch);
  }

  public short getByte(int byteIndex) {
    return chilkatJNI.CkByteData_getByte(swigCPtr, this, byteIndex);
  }

  public char getChar(int byteIndex) {
    return chilkatJNI.CkByteData_getChar(swigCPtr, this, byteIndex);
  }

  public long getUInt(int byteIndex) {
    return chilkatJNI.CkByteData_getUInt(swigCPtr, this, byteIndex);
  }

  public int getInt(int byteIndex) {
    return chilkatJNI.CkByteData_getInt(swigCPtr, this, byteIndex);
  }

  public int getUShort(int byteIndex) {
    return chilkatJNI.CkByteData_getUShort(swigCPtr, this, byteIndex);
  }

  public short getShort(int byteIndex) {
    return chilkatJNI.CkByteData_getShort(swigCPtr, this, byteIndex);
  }

  public boolean loadFile(String filename) {
    return chilkatJNI.CkByteData_loadFile(swigCPtr, this, filename);
  }

  public boolean saveFile(String filename) {
    return chilkatJNI.CkByteData_saveFile(swigCPtr, this, filename);
  }

  public boolean appendFile(String filename) {
    return chilkatJNI.CkByteData_appendFile(swigCPtr, this, filename);
  }

  public void shorten(int numBytes) {
    chilkatJNI.CkByteData_shorten(swigCPtr, this, numBytes);
  }

}
