Пример #1
0
        // bbuffer.c (359, 1)
        // bbufferExtendArray(bb, nbytes) as int
        // bbufferExtendArray(L_BBUFFER *, l_int32) as l_ok
        ///  <summary>
        /// (1) reallocNew() copies all bbtonalloc bytes, even though
        /// only bbton are data.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/bbufferExtendArray/*"/>
        ///  <param name="bb">[in] - bbuffer</param>
        ///  <param name="nbytes">[in] - number of bytes to extend array size</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int bbufferExtendArray(
            L_ByteBuffer bb,
            int nbytes)
        {
            if (bb == null)
            {
                throw new ArgumentNullException("bb cannot be Nothing");
            }

            int _Result = Natives.bbufferExtendArray(bb.Pointer, nbytes);

            return(_Result);
        }
Пример #2
0
        // bbuffer.c (167, 1)
        // bbufferDestroy(pbb) as Object
        // bbufferDestroy(L_BBUFFER **) as void
        ///  <summary>
        /// (1) Destroys the byte array in the bbuffer and then the bbuffer
        /// then nulls the contents of the input ptr.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/bbufferDestroy/*"/>
        ///  <param name="pbb">[in,out] - buffer to be nulled</param>
        public static void bbufferDestroy(
            ref L_ByteBuffer pbb)
        {
            IntPtr pbbPtr = IntPtr.Zero;    if (pbb != null)

            {
                pbbPtr = pbb.Pointer;
            }

            Natives.bbufferDestroy(ref pbbPtr);
            if (pbbPtr == IntPtr.Zero)
            {
                pbb = null;
            }
            else
            {
                pbb = new L_ByteBuffer(pbbPtr);
            };
        }
Пример #3
0
        // bbuffer.c (308, 1)
        // bbufferReadStream(bb, fp, nbytes) as int
        // bbufferReadStream(L_BBUFFER *, FILE *, l_int32) as l_ok
        ///  <summary>
        /// bbufferReadStream()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/bbufferReadStream/*"/>
        ///  <param name="bb">[in] - bbuffer</param>
        ///  <param name="fp">[in] - source stream from which bytes are read</param>
        ///  <param name="nbytes">[in] - bytes to be read</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int bbufferReadStream(
            L_ByteBuffer bb,
            FILE fp,
            int nbytes)
        {
            if (bb == null)
            {
                throw new ArgumentNullException("bb cannot be Nothing");
            }

            if (fp == null)
            {
                throw new ArgumentNullException("fp cannot be Nothing");
            }

            int _Result = Natives.bbufferReadStream(bb.Pointer, fp.Pointer, nbytes);

            return(_Result);
        }
Пример #4
0
        // bbuffer.c (262, 1)
        // bbufferRead(bb, src, nbytes) as int
        // bbufferRead(L_BBUFFER *, l_uint8 *, l_int32) as l_ok
        ///  <summary>
        /// (1) For a read after write, first remove the written
        /// bytes by shifting the unwritten bytes in the array,
        /// then check if there is enough room to add the new bytes.
        /// If not, realloc with bbufferExpandArray(), resulting
        /// in a second writing of the unwritten bytes.  While less
        /// efficient, this is simpler than making a special case
        /// of reallocNew().
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/bbufferRead/*"/>
        ///  <param name="bb">[in] - bbuffer</param>
        ///  <param name="src">[in] - source memory buffer from which bytes are read</param>
        ///  <param name="nbytes">[in] - bytes to be read</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int bbufferRead(
            L_ByteBuffer bb,
            Byte[] src,
            int nbytes)
        {
            if (bb == null)
            {
                throw new ArgumentNullException("bb cannot be Nothing");
            }

            if (src == null)
            {
                throw new ArgumentNullException("src cannot be Nothing");
            }

            int _Result = Natives.bbufferRead(bb.Pointer, src, nbytes);

            return(_Result);
        }
Пример #5
0
        // bbuffer.c (390, 1)
        // bbufferWrite(bb, dest, nbytes, pnout) as int
        // bbufferWrite(L_BBUFFER *, l_uint8 *, size_t, size_t *) as l_ok
        ///  <summary>
        /// bbufferWrite()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/bbufferWrite/*"/>
        ///  <param name="bb">[in] - bbuffer</param>
        ///  <param name="dest">[in] - dest memory buffer to which bytes are written</param>
        ///  <param name="nbytes">[in] - bytes requested to be written</param>
        ///  <param name="pnout">[out] - bytes actually written</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int bbufferWrite(
            L_ByteBuffer bb,
            Byte[] dest,
            uint nbytes,
            out uint pnout)
        {
            if (bb == null)
            {
                throw new ArgumentNullException("bb cannot be Nothing");
            }

            if (dest == null)
            {
                throw new ArgumentNullException("dest cannot be Nothing");
            }

            int _Result = Natives.bbufferWrite(bb.Pointer, dest, nbytes, out pnout);

            return(_Result);
        }
Пример #6
0
        // bbuffer.c (203, 1)
        // bbufferDestroyAndSaveData(pbb, pnbytes) as Byte[]
        // bbufferDestroyAndSaveData(L_BBUFFER **, size_t *) as l_uint8 *
        ///  <summary>
        /// (1) Copies data to newly allocated array then destroys the bbuffer.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/bbufferDestroyAndSaveData/*"/>
        ///  <param name="pbb">[in,out] - buffer to be nulled</param>
        ///  <param name="pnbytes">[out] - number of bytes saved in array</param>
        ///   <returns>barray newly allocated array of data</returns>
        public static Byte[] bbufferDestroyAndSaveData(
            ref L_ByteBuffer pbb,
            out uint pnbytes)
        {
            IntPtr pbbPtr = IntPtr.Zero;    if (pbb != null)

            {
                pbbPtr = pbb.Pointer;
            }

            Byte[] _Result = Natives.bbufferDestroyAndSaveData(ref pbbPtr, out pnbytes);
            if (pbbPtr == IntPtr.Zero)
            {
                pbb = null;
            }
            else
            {
                pbb = new L_ByteBuffer(pbbPtr);
            };

            return(_Result);
        }