コード例 #1
0
ファイル: Iterator.cs プロジェクト: DaanV2/leveldb-mcpe.Net
        /// <summary>
        /// Return the key for the current entry.
        /// REQUIRES: IsValid()
        /// </summary>
        public Byte[] Key()
        {
            IntPtr key = LevelDBInterop.leveldb_iter_key(this.Handle, out IntPtr length);

            this.Throw();

            Byte[] bytes = new Byte[(Int32)length];
            Marshal.Copy(key, bytes, 0, (Int32)length);
            GC.KeepAlive(this);
            return(bytes);
        }
コード例 #2
0
ファイル: Iterator.cs プロジェクト: robpaveza/leveldb.net
        /// <summary>
        /// Return the key for the current entry.
        /// REQUIRES: Valid()
        /// </summary>
        public byte[] Key()
        {
            int length;
            var key = LevelDBInterop.leveldb_iter_key(this.Handle, out length);

            Throw();

            var bytes = new byte[length];

            Marshal.Copy(key, bytes, 0, length);
            return(bytes);
        }
コード例 #3
0
        /// <summary>
        /// Return the key for the current entry.
        /// REQUIRES: IsValid()
        /// </summary>
        public byte[] Key()
        {
            IntPtr length;
            var    key = LevelDBInterop.leveldb_iter_key(Handle, out length);

            Throw();

            var bytes = new byte[(int)length];

            Marshal.Copy(key, bytes, 0, (int)length);
            GC.KeepAlive(this);
            return(bytes);
        }
コード例 #4
0
ファイル: Iterator.cs プロジェクト: robpaveza/leveldb.net
        /// <summary>
        /// Return the key for the current entry.
        /// REQUIRES: Valid()
        /// </summary>
        public int KeyAsInt()
        {
            int length;
            var key = LevelDBInterop.leveldb_iter_key(this.Handle, out length);

            Throw();

            if (length != 4)
            {
                throw new Exception("Key is not an integer");
            }

            return(Marshal.ReadInt32(key));
        }