@Override public void writeTo(OutputStream outputStream) throws IOException { for (Chunk chunk : chunks) { chunk.writeTo(outputStream); } trailerHeaders.writeTo(outputStream); }
@Override public void writeTo(OutputStream outputStream) throws IOException { for (Chunk chunk : chunks) { chunk.writeTo(outputStream); } trailerHeaders.writeTo(outputStream); }
@Override public void consumeInto( InputStream inputStream, OutputStream outputStream, int bufferSize) throws IOException { bodyParser.parseChunkedBody(inputStream, chunk -> chunk.writeTo(outputStream), trailer -> trailer.writeTo(outputStream)); }
@Override public void consumeInto( InputStream inputStream, OutputStream outputStream, int bufferSize) throws IOException { bodyParser.parseChunkedBody(inputStream, chunk -> chunk.writeTo(outputStream), trailer -> trailer.writeTo(outputStream)); }
/** * 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); } } }