Пример #1
0
            /// <exception cref="System.IO.IOException"/>
            public override void DoTest(BlockReaderLocal reader, byte[] original)
            {
                ByteBuffer buf = ByteBuffer.Wrap(new byte[TestLength]);

                reader.Skip(1);
                ReadFully(reader, buf, 1, 9);
                AssertArrayRegionsEqual(original, 1, ((byte[])buf.Array()), 1, 9);
                ReadFully(reader, buf, 10, 100);
                AssertArrayRegionsEqual(original, 10, ((byte[])buf.Array()), 10, 100);
                reader.ForceAnchorable();
                ReadFully(reader, buf, 110, 700);
                AssertArrayRegionsEqual(original, 110, ((byte[])buf.Array()), 110, 700);
                reader.ForceUnanchorable();
                reader.Skip(1);
                // skip from offset 810 to offset 811
                ReadFully(reader, buf, 811, 5);
                AssertArrayRegionsEqual(original, 811, ((byte[])buf.Array()), 811, 5);
            }
Пример #2
0
            /// <exception cref="System.IO.IOException"/>
            public override void DoTest(BlockReaderLocal reader, byte[] original)
            {
                ByteBuffer buf = ByteBuffer.AllocateDirect(TestLength);

                ReadFully(reader, buf, 0, 5120);
                buf.Flip();
                AssertArrayRegionsEqual(original, 0, DFSTestUtil.AsArray(buf), 0, 5120);
                reader.Skip(1537);
                ReadFully(reader, buf, 0, 1);
                buf.Flip();
                AssertArrayRegionsEqual(original, 6657, DFSTestUtil.AsArray(buf), 0, 1);
                reader.ForceAnchorable();
                ReadFully(reader, buf, 0, 5120);
                buf.Flip();
                AssertArrayRegionsEqual(original, 6658, DFSTestUtil.AsArray(buf), 0, 5120);
                reader.ForceUnanchorable();
                ReadFully(reader, buf, 0, 513);
                buf.Flip();
                AssertArrayRegionsEqual(original, 11778, DFSTestUtil.AsArray(buf), 0, 513);
                reader.Skip(3);
                ReadFully(reader, buf, 0, 50);
                buf.Flip();
                AssertArrayRegionsEqual(original, 12294, DFSTestUtil.AsArray(buf), 0, 50);
            }