akka.util.ByteString.length()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.0k)|赞(0)|评价(0)|浏览(117)

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

ByteString.length介绍

暂无

代码示例

代码示例来源:origin: com.typesafe.play/play_2.11

@Override
public Optional<Long> contentLength() {
  return Optional.of((long) data.length());
}

代码示例来源:origin: com.typesafe.play/play_2.12

@Override
public Optional<Long> contentLength() {
  return Optional.of((long) data.length());
}

代码示例来源:origin: com.typesafe.play/play

@Override
public Optional<Long> contentLength() {
  return Optional.of((long) data.length());
}

代码示例来源:origin: com.typesafe.play/play_2.11

/**
 * Set the body of the request.
 *
 * @param body The body.
 * @return the modified builder
 */
protected RequestBuilder body(RequestBody body) {
  if (body == null || body.as(Object.class) == null) {
    // assume null signifies no body; RequestBody is a wrapper for the actual body content
    headers(getHeaders().remove(HeaderNames.CONTENT_LENGTH).remove(HeaderNames.TRANSFER_ENCODING));
  } else {
    if (!getHeaders().get(HeaderNames.TRANSFER_ENCODING).isPresent()) {
      final MultipartFormData<?> multipartFormData = body.asMultipartFormData();
      if (multipartFormData != null) {
        header(HeaderNames.CONTENT_LENGTH, Long.toString(calcMultipartFormDataBodyLength(multipartFormData)));
      } else {
        int length = body.asBytes().length();
        header(HeaderNames.CONTENT_LENGTH, Integer.toString(length));
      }
    }
  }
  req = req.withBody(body);
  return this;
}

代码示例来源:origin: com.typesafe.play/play

/**
 * Set the body of the request.
 *
 * @param body The body.
 * @return the modified builder
 */
protected RequestBuilder body(RequestBody body) {
  if (body == null || body.as(Object.class) == null) {
    // assume null signifies no body; RequestBody is a wrapper for the actual body content
    headers(getHeaders().remove(HeaderNames.CONTENT_LENGTH).remove(HeaderNames.TRANSFER_ENCODING));
  } else {
    if (!getHeaders().get(HeaderNames.TRANSFER_ENCODING).isPresent()) {
      final MultipartFormData<?> multipartFormData = body.asMultipartFormData();
      if (multipartFormData != null) {
        header(HeaderNames.CONTENT_LENGTH, Long.toString(calcMultipartFormDataBodyLength(multipartFormData)));
      } else {
        int length = body.asBytes().length();
        header(HeaderNames.CONTENT_LENGTH, Integer.toString(length));
      }
    }
  }
  req = req.withBody(body);
  return this;
}

代码示例来源:origin: com.typesafe.play/play_2.12

/**
 * Set the body of the request.
 *
 * @param body The body.
 * @return the modified builder
 */
protected RequestBuilder body(RequestBody body) {
  if (body == null || body.as(Object.class) == null) {
    // assume null signifies no body; RequestBody is a wrapper for the actual body content
    headers(getHeaders().remove(HeaderNames.CONTENT_LENGTH).remove(HeaderNames.TRANSFER_ENCODING));
  } else {
    if (!getHeaders().get(HeaderNames.TRANSFER_ENCODING).isPresent()) {
      final MultipartFormData<?> multipartFormData = body.asMultipartFormData();
      if (multipartFormData != null) {
        header(HeaderNames.CONTENT_LENGTH, Long.toString(calcMultipartFormDataBodyLength(multipartFormData)));
      } else {
        int length = body.asBytes().length();
        header(HeaderNames.CONTENT_LENGTH, Integer.toString(length));
      }
    }
  }
  req = req.withBody(body);
  return this;
}

相关文章