com.github.kevinsawicki.http.HttpRequest.contentLength()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(83)

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

HttpRequest.contentLength介绍

[英]Get the 'Content-Length' header from the response
[中]从响应中获取“内容长度”标题

代码示例

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Is the response body empty?
 *
 * @return true if the Content-Length response header is 0, false otherwise
 * @throws HttpRequestException
 */
public boolean isBodyEmpty() throws HttpRequestException {
 return contentLength() == 0;
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Is the response body empty?
 *
 * @return true if the Content-Length response header is 0, false otherwise
 * @throws HttpRequestException
 */
public boolean isBodyEmpty() throws HttpRequestException {
 return contentLength() == 0;
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Is the response body empty?
 *
 * @return true if the Content-Length response header is 0, false otherwise
 * @throws HttpRequestException
 */
public boolean isBodyEmpty() throws HttpRequestException {
  return contentLength() == 0;
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Is the response body empty?
 *
 * @return true if the Content-Length response header is 0, false otherwise
 * @throws HttpRequestException
 */
public boolean isBodyEmpty() throws HttpRequestException {
  return contentLength() == 0;
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Set the 'Content-Length' request header to the given value
 *
 * @param value
 * @return this request
 */
public HttpRequest contentLength(final String value) {
 return contentLength(Integer.parseInt(value));
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Set the 'Content-Length' request header to the given value
 *
 * @param contentLength
 * @return this request
 */
public HttpRequest contentLength(final String contentLength) {
 return contentLength(Integer.parseInt(contentLength));
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Set the 'Content-Length' request header to the given value
 *
 * @param contentLength
 * @return this request
 */
public HttpRequest contentLength(final String contentLength) {
  return contentLength(Integer.parseInt(contentLength));
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Set the 'Content-Length' request header to the given value
 *
 * @param value
 * @return this request
 */
public HttpRequest contentLength(final String value) {
  return contentLength(Integer.parseInt(value));
}

代码示例来源:origin: com.github.kevinsawicki/http-request

/**
 * Create byte array output stream
 *
 * @return stream
 */
protected ByteArrayOutputStream byteStream() {
 final int size = contentLength();
 if (size > 0)
  return new ByteArrayOutputStream(size);
 else
  return new ByteArrayOutputStream();
}

代码示例来源:origin: tcking/GiraffePlayer2

/**
 * Create byte array output stream
 *
 * @return stream
 */
protected ByteArrayOutputStream byteStream() {
  final int size = contentLength();
  if (size > 0)
    return new ByteArrayOutputStream(size);
  else
    return new ByteArrayOutputStream();
}

代码示例来源:origin: com.restfuse/com.eclipsesource.restfuse

/**
 * Create byte array output stream
 *
 * @return stream
 */
protected ByteArrayOutputStream byteStream() {
 final int size = contentLength();
 if (size > 0)
  return new ByteArrayOutputStream(size);
 else
  return new ByteArrayOutputStream();
}

代码示例来源:origin: lkorth/httpebble-android

/**
 * Create byte array output stream
 *
 * @return stream
 */
protected ByteArrayOutputStream byteStream() {
  final int size = contentLength();
  if (size > 0)
    return new ByteArrayOutputStream(size);
  else
    return new ByteArrayOutputStream();
}

代码示例来源:origin: tcking/GiraffePlayer2

stream = getConnection().getInputStream();
} catch (IOException e) {
  if (contentLength() > 0)
    throw new HttpRequestException(e);
  else

代码示例来源:origin: com.github.kevinsawicki/http-request

stream = getConnection().getInputStream();
} catch (IOException e) {
 if (contentLength() > 0)
  throw new HttpRequestException(e);
 else

代码示例来源:origin: tcking/GiraffePlayer2

long total = 0;
int count;
int contentLength = request.contentLength();
while ((count = buffer.read(data)) != -1) {
  total += count;

相关文章

微信公众号

最新文章

更多

HttpRequest类方法