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

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

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

HttpRequest.openOutput介绍

[英]Open output stream
[中]开放输出流

代码示例

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

/**
 * Create writer to request output stream
 *
 * @return writer
 * @throws HttpRequestException
 */
public OutputStreamWriter writer() throws HttpRequestException {
 try {
  openOutput();
  return new OutputStreamWriter(output, output.encoder.charset());
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
}

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

/**
 * Create writer to request output stream
 *
 * @return writer
 * @throws HttpRequestException
 */
public OutputStreamWriter writer() throws HttpRequestException {
  try {
    openOutput();
    return new OutputStreamWriter(output, output.encoder.charset());
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
}

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

/**
 * Create writer to request output stream
 *
 * @return writer
 * @throws HttpRequestException
 */
public OutputStreamWriter writer() throws HttpRequestException {
 try {
  openOutput();
  return new OutputStreamWriter(output, output.encoder.charset());
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
}

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

/**
 * Create writer to request output stream
 *
 * @return writer
 * @throws HttpRequestException
 */
public OutputStreamWriter writer() throws HttpRequestException {
  try {
    openOutput();
    return new OutputStreamWriter(output, output.encoder.charset());
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
}

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

/**
 * Write char sequence to request body
 * <p>
 * The charset configured via {@link #contentType(String)} will be used and
 * UTF-8 will be used if it is unset.
 *
 * @param value
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final CharSequence value) throws HttpRequestException {
 try {
  openOutput();
  output.write(value.toString());
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
 return this;
}

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

/**
 * Write char sequence to request body
 * <p>
 * The charset configured via {@link #contentType(String)} will be used and
 * UTF-8 will be used if it is unset.
 *
 * @param value
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final CharSequence value) throws HttpRequestException {
 try {
  openOutput();
  output.write(value.toString());
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
 return this;
}

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

/**
 * Write char sequence to request body
 * <p/>
 * The charset configured via {@link #contentType(String)} will be used and
 * UTF-8 will be used if it is unset.
 *
 * @param value
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final CharSequence value) throws HttpRequestException {
  try {
    openOutput();
    output.write(value.toString());
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
  return this;
}

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

/**
 * Write stream to request body
 * <p>
 * The given stream will be closed once sending completes
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final InputStream input) throws HttpRequestException {
 try {
  openOutput();
  copy(input, output);
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
 return this;
}

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

/**
 * Write char sequence to request body
 * <p>
 * The charset configured via {@link #contentType(String)} will be used and
 * UTF-8 will be used if it is unset.
 *
 * @param value
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final CharSequence value) throws HttpRequestException {
  try {
    openOutput();
    output.write(value.toString());
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
  return this;
}

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

/**
 * Write stream to request body
 * <p/>
 * The given stream will be closed once sending completes
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final InputStream input) throws HttpRequestException {
  try {
    openOutput();
    copy(input, output);
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
  return this;
}

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

/**
 * Write stream to request body
 * <p>
 * The given stream will be closed once sending completes
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final InputStream input) throws HttpRequestException {
  try {
    openOutput();
    copy(input, output);
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
  return this;
}

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

/**
 * Write stream to request body
 * <p>
 * The given stream will be closed once sending completes
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final InputStream input) throws HttpRequestException {
 try {
  openOutput();
  copy(input, output);
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
 return this;
}

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

/**
 * Start part of a multipart
 *
 * @return this request
 * @throws IOException
 */
protected HttpRequest startPart() throws IOException {
 if (!multipart) {
  multipart = true;
  contentType(CONTENT_TYPE_MULTIPART).openOutput();
  output.write("--" + BOUNDARY + CRLF);
 } else
  output.write(CRLF + "--" + BOUNDARY + CRLF);
 return this;
}

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

/**
 * Start part of a multipart
 *
 * @return this request
 * @throws IOException
 */
protected HttpRequest startPart() throws IOException {
 if (!multipart) {
  multipart = true;
  contentType(CONTENT_TYPE_MULTIPART).openOutput();
  output.write("--" + BOUNDARY + CRLF);
 } else
  output.write(CRLF + "--" + BOUNDARY + CRLF);
 return this;
}

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

/**
 * Write reader to request body
 * <p>
 * The given reader will be closed once sending completes
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final Reader input) throws HttpRequestException {
  try {
    openOutput();
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
  final Writer writer = new OutputStreamWriter(output,
      output.encoder.charset());
  return new FlushOperation<HttpRequest>(writer) {
    @Override
    protected HttpRequest run() throws IOException {
      return copy(input, writer);
    }
  }.call();
}

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

/**
 * Write reader to request body
 * <p/>
 * The given reader will be closed once sending completes
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final Reader input) throws HttpRequestException {
  try {
    openOutput();
  } catch (IOException e) {
    throw new HttpRequestException(e);
  }
  final Writer writer = new OutputStreamWriter(output,
      output.encoder.charset());
  return new FlushOperation<HttpRequest>(writer) {
    @Override
    protected HttpRequest run() throws IOException {
      return copy(input, writer);
    }
  }.call();
}

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

/**
 * Write reader to request body
 * <p>
 * The given reader will be closed once sending completes
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final Reader input) throws HttpRequestException {
 try {
  openOutput();
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
 final Writer writer = new OutputStreamWriter(output,
   output.encoder.charset());
 return new FlushOperation<HttpRequest>(writer) {
  @Override
  protected HttpRequest run() throws IOException {
   return copy(input, writer);
  }
 }.call();
}

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

/**
 * Start part of a multipart
 *
 * @return this request
 * @throws IOException
 */
protected HttpRequest startPart() throws IOException {
  if (!multipart) {
    multipart = true;
    contentType(CONTENT_TYPE_MULTIPART).openOutput();
    output.write("--" + BOUNDARY + CRLF);
  } else
    output.write(CRLF + "--" + BOUNDARY + CRLF);
  return this;
}

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

/**
 * Write reader to request body
 * <p>
 * The given reader will be closed once sending completes
 *
 * @param input
 * @return this request
 * @throws HttpRequestException
 */
public HttpRequest send(final Reader input) throws HttpRequestException {
 try {
  openOutput();
 } catch (IOException e) {
  throw new HttpRequestException(e);
 }
 final Writer writer = new OutputStreamWriter(output,
   output.encoder.charset());
 return new FlushOperation<HttpRequest>(writer) {
  @Override
  protected HttpRequest run() throws IOException {
   return copy(input, writer);
  }
 }.call();
}

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

/**
 * Start part of a multipart
 *
 * @return this request
 * @throws IOException
 */
protected HttpRequest startPart() throws IOException {
  if (!multipart) {
    multipart = true;
    contentType(CONTENT_TYPE_MULTIPART).openOutput();
    output.write("--" + BOUNDARY + CRLF);
  } else
    output.write(CRLF + "--" + BOUNDARY + CRLF);
  return this;
}

相关文章

HttpRequest类方法