本文整理汇总了C#中System.ByteBuffer.Duplicate方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.Duplicate方法的具体用法?C# ByteBuffer.Duplicate怎么用?C# ByteBuffer.Duplicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.ByteBuffer
的用法示例。
在下文中一共展示了ByteBuffer.Duplicate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: test
//.........这里部分代码省略.........
fail("equals not reflexive", xb, xb, x, x);
}
foreach (byte y in VALUES)
{
ByteBuffer yb = Lucene.Net.Support.ByteBuffer.Wrap(new byte[] { y });
if (xb.CompareTo(yb) != -yb.CompareTo(xb))
{
fail("compareTo not anti-symmetric",
xb, yb, x, y);
}
if ((xb.CompareTo(yb) == 0) != xb.Equals(yb))
{
fail("compareTo inconsistent with equals",
xb, yb, x, y);
}
// from Byte.compare(x, y)
//return x - y;
if (xb.CompareTo(yb) != (x - y) /* Byte.Compare(x, y)*/)
{
fail("Incorrect results for ByteBuffer.compareTo",
xb, yb, x, y);
}
if (xb.equals(yb) != ((x == y) || ((x != x) && (y != y))))
{
fail("Incorrect results for ByteBuffer.equals",
xb, yb, x, y);
}
}
}
// Sub, dup
relPut(b);
relGet(b.Duplicate());
b.Position = (13);
relGet(b.Duplicate(), 13);
relGet(b.Duplicate().Slice(), 13);
relGet(b.Slice(), 13);
relGet(b.Slice().Duplicate(), 13);
// Slice
b.Position = (5);
ByteBuffer sb = b.Slice();
checkSlice(b, sb);
b.Position = (0);
ByteBuffer sb2 = sb.Slice();
checkSlice(sb, sb2);
if (!sb.Equals(sb2))
fail("Sliced slices do not match", sb, sb2);
if ((sb.HasArray) && (sb.ArrayOffset != sb2.ArrayOffset))
fail("Array offsets do not match: "
+ sb.ArrayOffset + " != " + sb2.ArrayOffset, sb, sb2);
// Views
b.Clear();
b.Order = (ByteOrder.BIG_ENDIAN);
testViews(level + 1, b, direct);
for (int i = 1; i <= 9; i++)
{
b.Position = (i);
Show(level + 1, b);
testViews(level + 2, b, direct);
示例2: callReset
//6231529
private static void callReset(ByteBuffer b)
{
b.Position = (0);
b.Mark();
b.Duplicate().Reset();
// LUCENENET: AsReadOnlyBuffer() not implemented
//b.AsReadOnlyBuffer().Reset();
}