本文整理匯總了Java中io.vertx.core.buffer.Buffer.getByteBuf方法的典型用法代碼示例。如果您正苦於以下問題:Java Buffer.getByteBuf方法的具體用法?Java Buffer.getByteBuf怎麽用?Java Buffer.getByteBuf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類io.vertx.core.buffer.Buffer
的用法示例。
在下文中一共展示了Buffer.getByteBuf方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onParse
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
protected void onParse(Buffer buffer) {
switch (status) {
case TCP_HEADER:
ByteBuf buf = buffer.getByteBuf();
if (!firstNEqual(TCP_MAGIC, buf.array(), TCP_MAGIC.length)) {
reset();
return;
}
buf.skipBytes(TCP_MAGIC.length);
msgId = buf.readLong();
totalLen = buf.readInt();
headerLen = buf.readInt();
if (totalLen == 0) {
onReadOnePackage(null, null);
return;
}
parser.fixedSizeMode(totalLen);
status = ParseStatus.TCP_PAYLOAD;
break;
case TCP_PAYLOAD:
Buffer headerBuffer = buffer.slice(0, headerLen);
Buffer bodyBuffer = buffer.slice(headerLen, buffer.length());
onReadOnePackage(headerBuffer, bodyBuffer);
break;
default:
break;
}
}
示例2: decodeResponse
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
default Object decodeResponse(Buffer buffer, JavaType type) throws Exception {
if (buffer.length() == 0) {
return null;
}
try (BufferInputStream input = new BufferInputStream(buffer.getByteBuf())) {
return doDecodeResponse(input, type);
}
}
示例3: getBytesFast
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
public static byte[] getBytesFast(Buffer buffer) {
ByteBuf byteBuf = buffer.getByteBuf();
return getBytesFast(byteBuf);
}
示例4: testUnsupportedMethod
import io.vertx.core.buffer.Buffer; //導入方法依賴的package包/類
@Test(expected = UnsupportedOperationException.class)
public void testUnsupportedMethod() {
final Buffer a = Symbol.newSymbol(Buffer.class);
a.getByteBuf();
}