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

namespace clucene.net {

using System;
using System.Runtime.InteropServices;

public class OutputStream : IDisposable {
  private HandleRef swigCPtr;
  protected bool swigCMemOwn;

  internal OutputStream(IntPtr cPtr, bool cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(OutputStream obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~OutputStream() {
    Dispose();
  }

  public virtual void Dispose() {
    if(swigCPtr.Handle != IntPtr.Zero && swigCMemOwn) {
      swigCMemOwn = false;
      libCLcsharpPINVOKE.delete_OutputStream(swigCPtr);
    }
    swigCPtr = new HandleRef(null, IntPtr.Zero);
    GC.SuppressFinalize(this);
  }

  public void writeByte(byte b) {
    libCLcsharpPINVOKE.OutputStream_writeByte(swigCPtr, b);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void writeBytes(byte[] b, int length) {
    libCLcsharpPINVOKE.OutputStream_writeBytes(swigCPtr, _CL_p_uint8_tArray.getCPtr(new _CL_p_uint8_tArray(b)), length);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void writeInt(int i) {
    libCLcsharpPINVOKE.OutputStream_writeInt(swigCPtr, i);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void writeVInt(int vi) {
    libCLcsharpPINVOKE.OutputStream_writeVInt(swigCPtr, vi);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void writeLong(long i) {
    libCLcsharpPINVOKE.OutputStream_writeLong(swigCPtr, i);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void writeVLong(long vi) {
    libCLcsharpPINVOKE.OutputStream_writeVLong(swigCPtr, vi);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void writeString(string s, int length) {
    libCLcsharpPINVOKE.OutputStream_writeString(swigCPtr, s, length);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public void writeChars(string s, int start, int length) {
    libCLcsharpPINVOKE.OutputStream_writeChars(swigCPtr, s, start, length);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public virtual void close() {
    libCLcsharpPINVOKE.OutputStream_close(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
  }

  public long getFilePointer() {
    long ret = libCLcsharpPINVOKE.OutputStream_getFilePointer(swigCPtr);
    if (libCLcsharpPINVOKE.SWIGPendingException.Pending) throw libCLcsharpPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

}

}
