internal static void AssertEqualContent(sbyte[] expected, ReadableBuffer actual)
 {
     for (int i = 0; i < expected.Length; i++)
     {
         if (expected[i] != actual.GetByte(i))
         {
             fail("expected <" + Arrays.ToString(expected) + "> but was <" + actual + ">");
         }
     }
 }
示例#2
0
            protected internal override string ReadKey(ReadableBuffer key)
            {
                StringBuilder result = new StringBuilder(16);

                for (int i = 0; i < key.Size(); i++)
                {
                    char c = ( char )(0xFF & key.GetByte(i));
                    if (c == ( char )0)
                    {
                        break;
                    }
                    result.Append(c);
                }
                return(result.ToString());
            }
        // IMPLEMENTATION

        /// <summary>
        /// Create a collector for interpreting metadata from a file. </summary>
        private MetadataCollector Metadata(ReadableBuffer formatSpecifier, int pageSize, int keySize, int valueSize)
        {
            sbyte[] format = new sbyte[formatSpecifier.Size()];
            for (int i = 0; i < format.Length; i++)
            {
                format[i] = formatSpecifier.GetByte(i);
            }
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final BigEndianByteArrayBuffer specifier = new BigEndianByteArrayBuffer(format);
            BigEndianByteArrayBuffer specifier = new BigEndianByteArrayBuffer(format);

//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: HeaderField<?>[] headerFields = headerFieldsForFormat(formatSpecifier);
            HeaderField <object>[] headerFields = HeaderFieldsForFormat(formatSpecifier);
            return(new MetadataCollectorAnonymousInnerClass(this, headerFields, specifier));
        }
            internal override bool verifyFormatSpecifier(ReadableBuffer value)
            {
                int            size           = value.Size();
                ReadableBuffer expectedFormat = expectedFormat();

                if (size == expectedFormat.Size())
                {
                    for (int i = 0; i < size; i++)
                    {
                        if (value.GetByte(i) != expectedFormat.GetByte(i))
                        {
                            return(false);
                        }
                    }
                    return(true);
                }
                return(false);
            }