org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf.readBytes()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(7.4k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf.readBytes()方法的一些代码示例,展示了ByteBuf.readBytes()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ByteBuf.readBytes()方法的具体详情如下:
包路径:org.apache.flink.shaded.netty4.io.netty.buffer.ByteBuf
类名称:ByteBuf
方法名:readBytes

ByteBuf.readBytes介绍

暂无

代码示例

代码示例来源:origin: apache/flink

@Override
  public KvStateResponse deserializeMessage(ByteBuf buf) {
    int length = buf.readInt();
    Preconditions.checkArgument(length >= 0,
        "Negative length for state content. " +
            "This indicates a serialization error.");
    byte[] content = new byte[length];
    buf.readBytes(content);
    return new KvStateResponse(content);
  }
}

代码示例来源:origin: apache/flink

@Override
  public TestMessage deserializeMessage(ByteBuf buf) {
    int length = buf.readInt();
    String message = "";
    if (length > 0) {
      byte[] name = new byte[length];
      buf.readBytes(name);
      message = new String(name, ConfigConstants.DEFAULT_CHARSET);
    }
    return new TestMessage(message);
  }
}

代码示例来源:origin: apache/flink

@Override
  public KvStateRequest deserializeMessage(ByteBuf buf) {
    JobID jobId = new JobID(buf.readLong(), buf.readLong());
    int statenameLength = buf.readInt();
    Preconditions.checkArgument(statenameLength >= 0,
        "Negative length for state name. " +
            "This indicates a serialization error.");
    String stateName = "";
    if (statenameLength > 0) {
      byte[] name = new byte[statenameLength];
      buf.readBytes(name);
      stateName = new String(name, ConfigConstants.DEFAULT_CHARSET);
    }
    int keyHashCode = buf.readInt();
    int knamespaceLength = buf.readInt();
    Preconditions.checkArgument(knamespaceLength >= 0,
        "Negative length for key and namespace. " +
            "This indicates a serialization error.");
    byte[] serializedKeyAndNamespace = new byte[knamespaceLength];
    if (knamespaceLength > 0) {
      buf.readBytes(serializedKeyAndNamespace);
    }
    return new KvStateRequest(jobId, stateName, keyHashCode, serializedKeyAndNamespace);
  }
}

代码示例来源:origin: apache/flink

@Override
  public KvStateInternalRequest deserializeMessage(ByteBuf buf) {
    KvStateID kvStateId = new KvStateID(buf.readLong(), buf.readLong());
    int length = buf.readInt();
    Preconditions.checkArgument(length >= 0,
        "Negative length for key and namespace. " +
            "This indicates a serialization error.");
    byte[] serializedKeyAndNamespace = new byte[length];
    if (length > 0) {
      buf.readBytes(serializedKeyAndNamespace);
    }
    return new KvStateInternalRequest(kvStateId, serializedKeyAndNamespace);
  }
}

代码示例来源:origin: com.alibaba.blink/flink-queryable-state-client-java

@Override
  public KvStateResponse deserializeMessage(ByteBuf buf) {
    int length = buf.readInt();
    Preconditions.checkArgument(length >= 0,
        "Negative length for state content. " +
            "This indicates a serialization error.");
    byte[] content = new byte[length];
    buf.readBytes(content);
    return new KvStateResponse(content);
  }
}

代码示例来源:origin: org.apache.flink/flink-queryable-state-client-java_2.11

@Override
  public KvStateResponse deserializeMessage(ByteBuf buf) {
    int length = buf.readInt();
    Preconditions.checkArgument(length >= 0,
        "Negative length for state content. " +
            "This indicates a serialization error.");
    byte[] content = new byte[length];
    buf.readBytes(content);
    return new KvStateResponse(content);
  }
}

代码示例来源:origin: com.alibaba.blink/flink-table

@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  ByteBuf buf = (ByteBuf) msg;
  byte[] request = new byte[buf.readableBytes()];
  buf.readBytes(request);
  byte call = request[0];
  switch (call) {
    case TableServiceMessage.GET_PARTITIONS:
      getPartitions(ctx, request);
      break;
    case TableServiceMessage.READ:
      read(ctx, request);
      break;
    case TableServiceMessage.WRITE:
      write(ctx, request);
      break;
    case TableServiceMessage.INITIALIZE_PARTITION:
      initializePartition(ctx, request);
      break;
    default:
      LOG.error("Unsupported call: " + call);
  }
}

代码示例来源:origin: com.alibaba.blink/flink-table

@Override
public synchronized void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception {
  ByteBuf buffer = (ByteBuf) msg;
  byte[] responseBytes = new byte[buffer.readableBytes()];
  buffer.readBytes(responseBytes);
  byte response = responseBytes[0];
  if (response == TableServiceMessage.SUCCESS) {
    switch (lastRequest) {
      case TableServiceMessage.GET_PARTITIONS:
        handleGetPartitionsResult(responseBytes);
        break;
      case TableServiceMessage.READ:
        handleReadResult(responseBytes);
        break;
      case TableServiceMessage.WRITE:
        handleWriteResult(responseBytes);
        break;
      case TableServiceMessage.INITIALIZE_PARTITION:
        handleInitializePartitionResult(responseBytes);
        break;
      default:
        LOG.error("Unsupported call: " + lastRequest);
    }
  } else {
    handleError(responseBytes);
  }
  notify();
}

代码示例来源:origin: com.alibaba.blink/flink-queryable-state-client-java

@Override
  public KvStateRequest deserializeMessage(ByteBuf buf) {
    JobID jobId = new JobID(buf.readLong(), buf.readLong());
    int statenameLength = buf.readInt();
    Preconditions.checkArgument(statenameLength >= 0,
        "Negative length for state name. " +
            "This indicates a serialization error.");
    String stateName = "";
    if (statenameLength > 0) {
      byte[] name = new byte[statenameLength];
      buf.readBytes(name);
      stateName = new String(name);
    }
    int keyHashCode = buf.readInt();
    int knamespaceLength = buf.readInt();
    Preconditions.checkArgument(knamespaceLength >= 0,
        "Negative length for key and namespace. " +
            "This indicates a serialization error.");
    byte[] serializedKeyAndNamespace = new byte[knamespaceLength];
    if (knamespaceLength > 0) {
      buf.readBytes(serializedKeyAndNamespace);
    }
    return new KvStateRequest(jobId, stateName, keyHashCode, serializedKeyAndNamespace);
  }
}

代码示例来源:origin: org.apache.flink/flink-queryable-state-client-java_2.11

@Override
  public KvStateRequest deserializeMessage(ByteBuf buf) {
    JobID jobId = new JobID(buf.readLong(), buf.readLong());
    int statenameLength = buf.readInt();
    Preconditions.checkArgument(statenameLength >= 0,
        "Negative length for state name. " +
            "This indicates a serialization error.");
    String stateName = "";
    if (statenameLength > 0) {
      byte[] name = new byte[statenameLength];
      buf.readBytes(name);
      stateName = new String(name, ConfigConstants.DEFAULT_CHARSET);
    }
    int keyHashCode = buf.readInt();
    int knamespaceLength = buf.readInt();
    Preconditions.checkArgument(knamespaceLength >= 0,
        "Negative length for key and namespace. " +
            "This indicates a serialization error.");
    byte[] serializedKeyAndNamespace = new byte[knamespaceLength];
    if (knamespaceLength > 0) {
      buf.readBytes(serializedKeyAndNamespace);
    }
    return new KvStateRequest(jobId, stateName, keyHashCode, serializedKeyAndNamespace);
  }
}

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

nettyBuffer.readBytes(buffer.asByteBuf(), receivedSize);
nettyBuffer.readBytes(byteArray);

代码示例来源:origin: org.apache.flink/flink-runtime

nettyBuffer.readBytes(buffer.asByteBuf(), receivedSize);
nettyBuffer.readBytes(byteArray);

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

nettyBuffer.readBytes(buffer.asByteBuf(), nettyBuffer.readableBytes());
stagedBufferResponse.releaseBuffer();

代码示例来源:origin: org.apache.flink/flink-runtime

nettyBuffer.readBytes(buffer.asByteBuf(), nettyBuffer.readableBytes());
stagedBufferResponse.releaseBuffer();

代码示例来源:origin: com.alibaba.blink/flink-runtime

nettyBuffer.readBytes(buffer.asByteBuf(), nettyBuffer.readableBytes());
stagedBufferResponse.releaseBuffer();

代码示例来源:origin: org.apache.flink/flink-runtime_2.11

nettyBuffer.readBytes(buffer.asByteBuf(), receivedSize);
nettyBuffer.readBytes(byteArray);

代码示例来源:origin: org.apache.flink/flink-runtime

nettyBuffer.readBytes(buffer.asByteBuf(), receivedSize);
nettyBuffer.readBytes(byteArray);

代码示例来源:origin: com.alibaba.blink/flink-runtime

nettyBuffer.readBytes(buffer.asByteBuf(), receivedSize);
nettyBuffer.readBytes(byteArray);

相关文章