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

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

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

HttpRequest.incrementTotalSize介绍

暂无

代码示例

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

/**
 * Write byte array to request body
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final byte[] input) throws HttpRequestException {
 if (input != null)
  incrementTotalSize(input.length);
 return send(new ByteArrayInputStream(input));
}

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

/**
 * Write byte array to request body
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final byte[] input) throws HttpRequestException {
  if (input != null)
    incrementTotalSize(input.length);
  return send(new ByteArrayInputStream(input));
}

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

/**
 * Write contents of file to request body
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final File input) throws HttpRequestException {
  final InputStream stream;
  try {
    stream = new BufferedInputStream(new FileInputStream(input));
    incrementTotalSize(input.length());
  } catch (FileNotFoundException e) {
    throw new HttpRequestException(e);
  }
  return send(stream);
}

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

/**
 * Write contents of file to request body
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final File input) throws HttpRequestException {
 final InputStream stream;
 try {
  stream = new BufferedInputStream(new FileInputStream(input));
  incrementTotalSize(input.length());
 } catch (FileNotFoundException e) {
  throw new HttpRequestException(e);
 }
 return send(stream);
}

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

/**
 * Write part of a multipart request to the request body
 *
 * @param name
 * @param filename
 * @param contentType
 *          value of the Content-Type part header
 * @param part
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest part(final String name, final String filename,
  final String contentType, final File part) throws HttpRequestException {
 final InputStream stream;
 try {
  stream = new BufferedInputStream(new FileInputStream(part));
  incrementTotalSize(part.length());
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
 return part(name, filename, contentType, stream);
}

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

/**
 * Write part of a multipart request to the request body
 *
 * @param name
 * @param filename
 * @param contentType
 *          value of the Content-Type part header
 * @param part
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest part(final String name, final String filename,
            final String contentType, final File part) throws HttpRequestException {
  final InputStream stream;
  try {
    stream = new BufferedInputStream(new FileInputStream(part));
    incrementTotalSize(part.length());
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
  return part(name, filename, contentType, stream);
}

相关文章

HttpRequest类方法