summaryrefslogtreecommitdiff
path: root/lang/csharp/src/Internal/DB_STREAM.cs
diff options
context:
space:
mode:
Diffstat (limited to 'lang/csharp/src/Internal/DB_STREAM.cs')
-rw-r--r--lang/csharp/src/Internal/DB_STREAM.cs88
1 files changed, 88 insertions, 0 deletions
diff --git a/lang/csharp/src/Internal/DB_STREAM.cs b/lang/csharp/src/Internal/DB_STREAM.cs
new file mode 100644
index 00000000..fef9da68
--- /dev/null
+++ b/lang/csharp/src/Internal/DB_STREAM.cs
@@ -0,0 +1,88 @@
+/* ----------------------------------------------------------------------------
+ * This file was automatically generated by SWIG (http://www.swig.org).
+ * Version 2.0.12
+ *
+ * Do not make changes to this file unless you know what you are doing--modify
+ * the SWIG interface file instead.
+ * ----------------------------------------------------------------------------- */
+
+namespace BerkeleyDB.Internal {
+
+using System;
+using System.Runtime.InteropServices;
+
+internal class DB_STREAM : IDisposable {
+ private HandleRef swigCPtr;
+ protected bool swigCMemOwn;
+
+ internal DB_STREAM(IntPtr cPtr, bool cMemoryOwn) {
+ swigCMemOwn = cMemoryOwn;
+ swigCPtr = new HandleRef(this, cPtr);
+ }
+
+ internal static HandleRef getCPtr(DB_STREAM obj) {
+ return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
+ }
+
+ ~DB_STREAM() {
+ Dispose();
+ }
+
+ public virtual void Dispose() {
+ lock(this) {
+ if (swigCPtr.Handle != IntPtr.Zero) {
+ if (swigCMemOwn) {
+ swigCMemOwn = false;
+ libdb_csharpPINVOKE.delete_DB_STREAM(swigCPtr);
+ }
+ swigCPtr = new HandleRef(null, IntPtr.Zero);
+ }
+ GC.SuppressFinalize(this);
+ }
+ }
+
+ internal int close(uint flags) {
+ int ret = libdb_csharpPINVOKE.DB_STREAM_close(swigCPtr, flags);
+ if (ret == 0)
+ /* Close is a db handle destructor. Reflect that in the wrapper class. */
+ swigCPtr = new HandleRef(null, IntPtr.Zero);
+ else
+ DatabaseException.ThrowException(ret);
+ return ret;
+}
+
+ internal int read(DatabaseEntry data, Int64 offset, uint size, uint flags) {
+ try {
+ int ret;
+ ret = libdb_csharpPINVOKE.DB_STREAM_read(swigCPtr, DBT.getCPtr(DatabaseEntry.getDBT(data)), offset, size, flags);
+ DatabaseException.ThrowException(ret);
+ return ret;
+} finally {
+ GC.KeepAlive(data);
+ }
+ }
+
+ internal int size(ref Int64 size, uint flags) {
+ int ret;
+ ret = libdb_csharpPINVOKE.DB_STREAM_size(swigCPtr, ref size, flags);
+ DatabaseException.ThrowException(ret);
+ return ret;
+}
+
+ internal int write(DatabaseEntry data, Int64 offset, uint flags) {
+ try {
+ int ret;
+ ret = libdb_csharpPINVOKE.DB_STREAM_write(swigCPtr, DBT.getCPtr(DatabaseEntry.getDBT(data)), offset, flags);
+ DatabaseException.ThrowException(ret);
+ return ret;
+} finally {
+ GC.KeepAlive(data);
+ }
+ }
+
+ internal DB_STREAM() : this(libdb_csharpPINVOKE.new_DB_STREAM(), true) {
+ }
+
+}
+
+}