org.glassfish.tyrus.core.Utils.getRemainingArray()方法的使用及代码示例

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

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

Utils.getRemainingArray介绍

[英]Creates the array of bytes containing the bytes from the position to the limit of the ByteBuffer.
[中]创建字节数组,其中包含从字节缓冲区的位置到限制的字节。

代码示例

代码示例来源:origin: eclipse-ee4j/tyrus

private String bufferToString() {
  byte[] bytes = Utils.getRemainingArray(buffer);
  String str;
  try {
    str = new String(bytes, ENCODING);
  } catch (UnsupportedEncodingException e) {
    throw new RuntimeException("Unsupported encoding" + ENCODING, e);
  }
  return str;
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendPong(ByteBuffer applicationData) throws IOException, IllegalArgumentException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(
        "Pong applicationData exceeded the maximum allowed payload of 125 bytes.");
  }
  clusterContext.sendPong(sessionId, Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendPing(ByteBuffer applicationData) throws IOException, IllegalArgumentException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(
        "Ping applicationData exceeded the maximum allowed payload of 125 bytes.");
  }
  clusterContext.sendPing(sessionId, Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendPing(ByteBuffer applicationData) throws IOException, IllegalArgumentException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(
        "Ping applicationData exceeded the maximum allowed payload of 125 bytes.");
  }
  clusterContext.sendPing(sessionId, Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
public void sendPong(ByteBuffer applicationData) throws IOException, IllegalArgumentException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(
        "Pong applicationData exceeded the maximum allowed payload of 125 bytes.");
  }
  clusterContext.sendPong(sessionId, Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
public void sendPong(ByteBuffer applicationData) throws IOException, IllegalArgumentException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(
        "Pong applicationData exceeded the maximum allowed payload of 125 bytes.");
  }
  clusterContext.sendPong(sessionId, Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendPong(ByteBuffer applicationData) throws IOException, IllegalArgumentException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(
        "Pong applicationData exceeded the maximum allowed payload of 125 bytes.");
  }
  clusterContext.sendPong(sessionId, Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
public void sendPing(ByteBuffer applicationData) throws IOException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(LocalizationMessages.APPLICATION_DATA_TOO_LONG("Ping"));
  }
  session.restartIdleTimeoutExecutor();
  webSocket.sendPing(Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public Future<Void> sendBinary(ByteBuffer data) {
  checkNotNull(data, "data");
  return clusterContext.sendBinary(sessionId, Utils.getRemainingArray(data));
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
public void sendPong(ByteBuffer applicationData) throws IOException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(LocalizationMessages.APPLICATION_DATA_TOO_LONG("Pong"));
  }
  session.restartIdleTimeoutExecutor();
  webSocket.sendPong(Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
public Future<Void> sendBinary(ByteBuffer data) {
  checkNotNull(data, "data");
  return clusterContext.sendBinary(sessionId, Utils.getRemainingArray(data));
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendPong(ByteBuffer applicationData) throws IOException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(LocalizationMessages.APPLICATION_DATA_TOO_LONG("Pong"));
  }
  session.restartIdleTimeoutExecutor();
  webSocket.sendPong(Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendPing(ByteBuffer applicationData) throws IOException {
  if (applicationData != null && applicationData.remaining() > 125) {
    throw new IllegalArgumentException(LocalizationMessages.APPLICATION_DATA_TOO_LONG("Ping"));
  }
  session.restartIdleTimeoutExecutor();
  webSocket.sendPing(Utils.getRemainingArray(applicationData));
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendBinary(ByteBuffer data, SendHandler handler) {
  checkNotNull(data, "data");
  checkNotNull(handler, "handler");
  clusterContext.sendBinary(sessionId, Utils.getRemainingArray(data), handler);
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendBinary(ByteBuffer data) throws IOException {
  checkNotNull(data, "data");
  final Future<?> future = clusterContext.sendBinary(sessionId, Utils.getRemainingArray(data));
  processFuture(future);
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException {
  checkNotNull(partialByte, "partialByte");
  final Future<?> future =
      clusterContext.sendBinary(sessionId, Utils.getRemainingArray(partialByte), isLast);
  processFuture(future);
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
public void sendBinary(ByteBuffer data) throws IOException {
  checkNotNull(data, "data");
  final Future<?> future = clusterContext.sendBinary(sessionId, Utils.getRemainingArray(data));
  processFuture(future);
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendBinary(ByteBuffer partialByte, boolean isLast) throws IOException {
  checkNotNull(partialByte, "partialByte");
  session.getDebugContext().appendLogMessage(LOGGER, Level.FINEST, DebugContext.Type.MESSAGE_OUT,
                        "Sending partial binary message");
  final Future<?> future = webSocket.sendBinary(Utils.getRemainingArray(partialByte), isLast);
  try {
    processFuture(future);
  } finally {
    session.restartIdleTimeoutExecutor();
  }
}

代码示例来源:origin: eclipse-ee4j/tyrus

@Override
public void sendBinary(ByteBuffer data) throws IOException {
  checkNotNull(data, "data");
  session.getDebugContext()
      .appendLogMessage(LOGGER, Level.FINEST, DebugContext.Type.MESSAGE_OUT, "Sending binary message");
  final Future<?> future = webSocket.sendBinary(Utils.getRemainingArray(data));
  try {
    processFuture(future);
  } finally {
    session.restartIdleTimeoutExecutor();
  }
}

代码示例来源:origin: org.glassfish.tyrus/tyrus-core

@Override
public void sendBinary(ByteBuffer data) throws IOException {
  checkNotNull(data, "data");
  session.getDebugContext()
      .appendLogMessage(LOGGER, Level.FINEST, DebugContext.Type.MESSAGE_OUT, "Sending binary message");
  final Future<?> future = webSocket.sendBinary(Utils.getRemainingArray(data));
  try {
    processFuture(future);
  } finally {
    session.restartIdleTimeoutExecutor();
  }
}

相关文章