/** * Read the raw HTTP message body, simultaneously writing it to the given output. * <p> * This method may not validate the full HTTP message before it starts writing it out. * To perform a full validation first, call {@link #eager()} to get an eager reader. * * @param out to write the HTTP body to * @throws IOException if an error occurs while writing the message * @see BodyReader#writeDecodedTo(OutputStream) */ @Override public void writeTo(OutputStream out) throws IOException { writeTo(out, BodyConsumer.DEFAULT_BUFFER_SIZE); }
/** * Read the raw HTTP message body, simultaneously writing it to the given output. * <p> * This method may not validate the full HTTP message before it starts writing it out. * To perform a full validation first, call {@link #eager()} to get an eager reader. * * @param out to write the HTTP body to * @throws IOException if an error occurs while writing the message * @see BodyReader#writeDecodedTo(OutputStream) */ @Override public void writeTo(OutputStream out) throws IOException { writeTo(out, BodyConsumer.DEFAULT_BUFFER_SIZE); }
@Override public void writeTo(OutputStream out, int bufferSize) throws IOException { markConsumed(); super.writeTo(out, bufferSize); }
@Override public void writeTo(OutputStream out, int bufferSize) throws IOException { markConsumed(); super.writeTo(out, bufferSize); }
/** * Write this HTTP message to the given output. * * @param out to write this HTTP message to * @param bufferSize size of the buffer to use for writing * @throws IOException if an error occurs while writing the message */ public void writeTo(OutputStream out, int bufferSize) throws IOException { getStartLine().writeTo(out); getHeaders().writeTo(out); Optional<? extends BodyReader> body = getBody(); if (body.isPresent()) { try (BodyReader bodyReader = body.get()) { bodyReader.writeTo(out, bufferSize); } } }
/** * Write this HTTP message to the given output. * * @param out to write this HTTP message to * @param bufferSize size of the buffer to use for writing * @throws IOException if an error occurs while writing the message */ public void writeTo(OutputStream out, int bufferSize) throws IOException { getStartLine().writeTo(out); getHeaders().writeTo(out); Optional<? extends BodyReader> body = getBody(); if (body.isPresent()) { try (BodyReader bodyReader = body.get()) { bodyReader.writeTo(out, bufferSize); } } }
if (options.printBodyOnly) { if (response.getBody().isPresent()) { response.getBody().get().writeTo(System.out);