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

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

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

ByteBuf.readLong介绍

暂无

代码示例

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

/**
 * De-serializes the header and returns the {@link MessageType}.
 * <pre>
 *  <b>The buffer is expected to be at the request id position.</b>
 * </pre>
 * @param buf    The {@link ByteBuf} containing the serialized request id.
 * @return        The request id.
 */
public static long getRequestId(final ByteBuf buf) {
  return buf.readLong();
}

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

/**
 * De-serializes the {@link RequestFailure} sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * protocol related errors.
 * <pre>
 *  <b>The buffer is expected to be at the correct position.</b>
 * </pre>
 * @param buf    The {@link ByteBuf} containing the serialized failure message.
 * @return        The failure message.
 */
public static RequestFailure deserializeRequestFailure(final ByteBuf buf) throws IOException, ClassNotFoundException {
  long requestId = buf.readLong();
  Throwable cause;
  try (ByteBufInputStream bis = new ByteBufInputStream(buf);
      ObjectInputStream in = new ObjectInputStream(bis)) {
    cause = (Throwable) in.readObject();
  }
  return new RequestFailure(requestId, cause);
}

代码示例来源: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: 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: org.apache.flink/flink-queryable-state-client-java_2.11

/**
 * De-serializes the header and returns the {@link MessageType}.
 * <pre>
 *  <b>The buffer is expected to be at the request id position.</b>
 * </pre>
 * @param buf    The {@link ByteBuf} containing the serialized request id.
 * @return        The request id.
 */
public static long getRequestId(final ByteBuf buf) {
  return buf.readLong();
}

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

/**
 * De-serializes the header and returns the {@link MessageType}.
 * <pre>
 *  <b>The buffer is expected to be at the request id position.</b>
 * </pre>
 * @param buf    The {@link ByteBuf} containing the serialized request id.
 * @return        The request id.
 */
public static long getRequestId(final ByteBuf buf) {
  return buf.readLong();
}

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

public static InputChannelID fromByteBuf(ByteBuf buf) {
    long lower = buf.readLong();
    long upper = buf.readLong();
    return new InputChannelID(lower, upper);
  }
}

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

public static ExecutionAttemptID fromByteBuf(ByteBuf buf) {
    long lower = buf.readLong();
    long upper = buf.readLong();
    return new ExecutionAttemptID(lower, upper);
  }
}

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

public static IntermediateResultPartitionID fromByteBuf(ByteBuf buf) {
    long lower = buf.readLong();
    long upper = buf.readLong();
    return new IntermediateResultPartitionID(lower, upper);
  }
}

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

public static InputChannelID fromByteBuf(ByteBuf buf) {
    long lower = buf.readLong();
    long upper = buf.readLong();
    return new InputChannelID(lower, upper);
  }
}

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

public static IntermediateResultPartitionID fromByteBuf(ByteBuf buf) {
    long lower = buf.readLong();
    long upper = buf.readLong();
    return new IntermediateResultPartitionID(lower, upper);
  }
}

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

public static IntermediateResultPartitionID fromByteBuf(ByteBuf buf) {
    long lower = buf.readLong();
    long upper = buf.readLong();
    return new IntermediateResultPartitionID(lower, upper);
  }
}

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

public static InputChannelID fromByteBuf(ByteBuf buf) {
    long lower = buf.readLong();
    long upper = buf.readLong();
    return new InputChannelID(lower, upper);
  }
}

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

public static ExecutionAttemptID fromByteBuf(ByteBuf buf) {
    long lower = buf.readLong();
    long upper = buf.readLong();
    return new ExecutionAttemptID(lower, upper);
  }
}

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

public static ExecutionAttemptID fromByteBuf(ByteBuf buf) {
  long lower = buf.readLong();
  long upper = buf.readLong();
  return new ExecutionAttemptID(lower, upper);
}

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

/**
 * De-serializes the {@link RequestFailure} sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * protocol related errors.
 * <pre>
 *  <b>The buffer is expected to be at the correct position.</b>
 * </pre>
 * @param buf    The {@link ByteBuf} containing the serialized failure message.
 * @return        The failure message.
 */
public static RequestFailure deserializeRequestFailure(final ByteBuf buf) throws IOException, ClassNotFoundException {
  long requestId = buf.readLong();
  Throwable cause;
  try (ByteBufInputStream bis = new ByteBufInputStream(buf);
      ObjectInputStream in = new ObjectInputStream(bis)) {
    cause = (Throwable) in.readObject();
  }
  return new RequestFailure(requestId, cause);
}

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

/**
 * De-serializes the {@link RequestFailure} sent to the
 * {@link org.apache.flink.queryablestate.network.Client} in case of
 * protocol related errors.
 * <pre>
 *  <b>The buffer is expected to be at the correct position.</b>
 * </pre>
 * @param buf    The {@link ByteBuf} containing the serialized failure message.
 * @return        The failure message.
 */
public static RequestFailure deserializeRequestFailure(final ByteBuf buf) throws IOException, ClassNotFoundException {
  long requestId = buf.readLong();
  Throwable cause;
  try (ByteBufInputStream bis = new ByteBufInputStream(buf);
      ObjectInputStream in = new ObjectInputStream(bis)) {
    cause = (Throwable) in.readObject();
  }
  return new RequestFailure(requestId, cause);
}

代码示例来源: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: 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);
  }
}

相关文章