Java Code Examples for org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf#getByte()
The following examples show how to use
org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf#getByte() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReadOnlySlicedBufferTest.java From Flink-CEPplus with Apache License 2.0 | 6 votes |
private static void assertReadableBytes(Buffer actualBuffer, int... expectedBytes) { ByteBuffer actualBytesBuffer = actualBuffer.getNioBufferReadable(); int[] actual = new int[actualBytesBuffer.limit()]; for (int i = 0; i < actual.length; ++i) { actual[i] = actualBytesBuffer.get(); } assertArrayEquals(expectedBytes, actual); // verify absolutely positioned read method: ByteBuf buffer = (ByteBuf) actualBuffer; for (int i = 0; i < buffer.readableBytes(); ++i) { actual[i] = buffer.getByte(buffer.readerIndex() + i); } assertArrayEquals(expectedBytes, actual); // verify relatively positioned read method: for (int i = 0; i < buffer.readableBytes(); ++i) { actual[i] = buffer.readByte(); } assertArrayEquals(expectedBytes, actual); }
Example 2
Source File: ReadOnlySlicedBufferTest.java From flink with Apache License 2.0 | 6 votes |
private static void assertReadableBytes(Buffer actualBuffer, int... expectedBytes) { ByteBuffer actualBytesBuffer = actualBuffer.getNioBufferReadable(); int[] actual = new int[actualBytesBuffer.limit()]; for (int i = 0; i < actual.length; ++i) { actual[i] = actualBytesBuffer.get(); } assertArrayEquals(expectedBytes, actual); // verify absolutely positioned read method: ByteBuf buffer = (ByteBuf) actualBuffer; for (int i = 0; i < buffer.readableBytes(); ++i) { actual[i] = buffer.getByte(buffer.readerIndex() + i); } assertArrayEquals(expectedBytes, actual); // verify relatively positioned read method: for (int i = 0; i < buffer.readableBytes(); ++i) { actual[i] = buffer.readByte(); } assertArrayEquals(expectedBytes, actual); }
Example 3
Source File: ReadOnlySlicedBufferTest.java From flink with Apache License 2.0 | 6 votes |
private static void assertReadableBytes(Buffer actualBuffer, int... expectedBytes) { ByteBuffer actualBytesBuffer = actualBuffer.getNioBufferReadable(); int[] actual = new int[actualBytesBuffer.limit()]; for (int i = 0; i < actual.length; ++i) { actual[i] = actualBytesBuffer.get(); } assertArrayEquals(expectedBytes, actual); // verify absolutely positioned read method: ByteBuf buffer = (ByteBuf) actualBuffer; for (int i = 0; i < buffer.readableBytes(); ++i) { actual[i] = buffer.getByte(buffer.readerIndex() + i); } assertArrayEquals(expectedBytes, actual); // verify relatively positioned read method: for (int i = 0; i < buffer.readableBytes(); ++i) { actual[i] = buffer.readByte(); } assertArrayEquals(expectedBytes, actual); }
Example 4
Source File: ByteBufUtilsTest.java From flink with Apache License 2.0 | 4 votes |
private void verifyBufferContent(ByteBuf buf, int start, int length) { for (int i = 0; i < length; ++i) { byte b = buf.getByte(start + i); assertEquals(String.format("The byte at position %d is not right.", start + i), ACCUMULATION_BYTE, b); } }