Ejemplo n.º 1
0
 private static void AssertEmpty(PageCursor cursor)
 {
     sbyte[] data = new sbyte[PAGE_SIZE];
     cursor.GetBytes(data);
     foreach (sbyte b in data)
     {
         assertEquals(0, b);
     }
 }
Ejemplo n.º 2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public Record readRecord(org.neo4j.io.pagecache.PageCursor cursor) throws java.io.IOException
        public override Record ReadRecord(PageCursor cursor)
        {
            int offset = cursor.Offset;

            sbyte[] bytes = new sbyte[RecordSize];
            do
            {
                cursor.Offset = offset;
                cursor.GetBytes(bytes);
            } while (cursor.ShouldRetry());
            return(new PageCountRecord(bytes));
        }
Ejemplo n.º 3
0
        public override void ReadKey(PageCursor cursor, StringIndexKey into, int keySize)
        {
            if (keySize < ENTITY_ID_SIZE)
            {
                into.EntityId          = long.MinValue;
                into.BytesLength       = 0;
                cursor.CursorException = format("Reading string index key with an unexpected keySize:%d", keySize);
                return;
            }
            into.EntityId = cursor.Long;
            int bytesLength = keySize - ENTITY_ID_SIZE;

            into.BytesLength = bytesLength;
            cursor.GetBytes(into.Bytes, 0, bytesLength);
        }
Ejemplo n.º 4
0
        public static void ReadData(DynamicRecord record, PageCursor cursor)
        {
            int len = record.Length;

            if (len == 0)                 // don't go though the trouble of acquiring the window if we would read nothing
            {
                record.Data = NO_DATA;
                return;
            }

            sbyte[] data = record.Data;
            if (data == null || data.Length != len)
            {
                data = new sbyte[len];
            }
            cursor.GetBytes(data);
            record.Data = data;
        }
Ejemplo n.º 5
0
        internal static bool Read(PageCursor cursor, int maxSize, GenericKey into)
        {
            // For performance reasons cannot be redirected to writeString, due to byte[] reuse
            short rawLength   = cursor.Short;
            bool  isCharType  = (rawLength & CHAR_TYPE_LENGTH_MARKER) != 0;
            short bytesLength = ( short )(rawLength & ~CHAR_TYPE_LENGTH_MARKER);

            if (bytesLength < 0 || bytesLength > maxSize)
            {
                setCursorException(cursor, "non-valid bytes length for text, " + bytesLength);
                return(false);
            }

            // Remember this fact, i.e. set the flag in this state
            SetCharType(into, isCharType);
            SetBytesLength(into, bytesLength);
            cursor.GetBytes(into.ByteArray, 0, bytesLength);
            return(true);
        }
Ejemplo n.º 6
0
 public override void ReadValue(PageCursor cursor, RawBytes into, int valueSize)
 {
     into.Bytes = new sbyte[valueSize];
     cursor.GetBytes(into.Bytes);
 }
Ejemplo n.º 7
0
 public override void ReadKey(PageCursor cursor, RawBytes into, int keySize)
 {
     into.Bytes = new sbyte[keySize];
     cursor.GetBytes(into.Bytes);
 }
Ejemplo n.º 8
0
 public override void GetFrom(PageCursor cursor)
 {
     cursor.GetBytes(Buffer);
 }