return new FramedBody.Chunked(bodyDecoder, metadataParser);
/** * @return the body of the HTTP message as a {@link ChunkedBodyContents} if the body indeed used * the chunked transfer coding. If the body was not chunked, this method returns an empty value. * @throws IOException if an error occurs while consuming the message body */ public Optional<ChunkedBodyContents> asChunkedBodyContents() throws IOException { return framedBody.use( cl -> Optional.empty(), chunked -> Optional.of(chunked.getContents(asRawStream())), ct -> Optional.empty()); }
@Override public int hashCode() { return getEncodings().hashCode(); }
return new FramedBody.Chunked(bodyDecoder, metadataParser);
@Override public int hashCode() { return getEncodings().hashCode(); }
@Override public boolean equals(Object other) { if (this == other) return true; if (other == null || getClass() != other.getClass()) return false; Chunked chunked = (Chunked) other; return getEncodings().equals(chunked.getEncodings()); }
/** * @return the body of the HTTP message as a {@link ChunkedBodyContents} if the body indeed used * the chunked transfer coding. If the body was not chunked, this method returns an empty value. * @throws IOException if an error occurs while consuming the message body */ public Optional<ChunkedBodyContents> asChunkedBodyContents() throws IOException { return framedBody.use( cl -> Optional.empty(), chunked -> Optional.of(chunked.getContents(asRawStream())), ct -> Optional.empty()); }
@Override public String toString() { return "Chunked{" + "encodings=" + getEncodings() + '}'; } }
@Override public LazyBodyReader toBodyReader() { return new LazyBodyReader(new FramedBody.Chunked(getBodyDecoder(), metadataParser), new InputStreamChunkEncoder(stream, chunkLength)); }
@Override public LazyBodyReader toBodyReader() { return new LazyBodyReader( new FramedBody.Chunked(getBodyDecoder(), createStrictHttpMetadataParser()), stream); }
@Override public String toString() { return "Chunked{" + "encodings=" + getEncodings() + '}'; } }
@Override public boolean equals(Object other) { if (this == other) return true; if (other == null || getClass() != other.getClass()) return false; Chunked chunked = (Chunked) other; return getEncodings().equals(chunked.getEncodings()); }
@Override public LazyBodyReader toBodyReader() { return new LazyBodyReader(new FramedBody.Chunked(getBodyDecoder(), metadataParser), new InputStreamChunkEncoder(stream, chunkLength)); }