/** * Create an {@link EagerBodyReader}. * * @param framedBody the framed body * @param inputStream providing the body. The body is consumed immediately * @throws IOException if the inputStream throws */ public EagerBodyReader(FramedBody framedBody, @Nonnull InputStream inputStream) throws IOException { super(framedBody); this.rawInputStream = inputStream; this.rawBytes = framedBody.getBodyConsumer().consume(inputStream); }
/** * Create an {@link EagerBodyReader}. * * @param framedBody the framed body * @param inputStream providing the body. The body is consumed immediately * @throws IOException if the inputStream throws */ public EagerBodyReader(FramedBody framedBody, @Nonnull InputStream inputStream) throws IOException { super(framedBody); this.rawInputStream = inputStream; this.rawBytes = framedBody.getBodyConsumer().consume(inputStream); }
/** * @return the raw HTTP message's body as bytes. * <p> * This method does not unframe nor decode the body in case the body is encoded. * To get the decoded body, use * {@link #decodeBody()} or {@link #decodeBodyToString(Charset)}. * @throws IOException if an error occurs while consuming the message body */ public byte[] asRawBytes() throws IOException { return framedBody.getBodyConsumer().consume(asRawStream()); }
/** * @return the raw HTTP message's body as bytes. * <p> * This method does not unframe nor decode the body in case the body is encoded. * To get the decoded body, use * {@link #decodeBody()} or {@link #decodeBodyToString(Charset)}. * @throws IOException if an error occurs while consuming the message body */ public byte[] asRawBytes() throws IOException { return framedBody.getBodyConsumer().consume(asRawStream()); }