WritableHttpEntity Class — spring-boot Architecture
Architecture documentation for the WritableHttpEntity class in HttpClientTransport.java from the spring-boot codebase.
Entity Profile
Relationship Graph
Source Code
buildpack/spring-boot-buildpack-platform/src/main/java/org/springframework/boot/buildpack/platform/docker/transport/HttpClientTransport.java lines 225–277
private static class WritableHttpEntity extends AbstractHttpEntity {
private final IOConsumer<OutputStream> writer;
WritableHttpEntity(String contentType, IOConsumer<OutputStream> writer) {
super(contentType, "UTF-8");
this.writer = writer;
}
@Override
public boolean isRepeatable() {
return false;
}
@Override
public long getContentLength() {
if (this.getContentType() != null && this.getContentType().equals("application/json")) {
return calculateStringContentLength();
}
return -1;
}
@Override
public InputStream getContent() throws UnsupportedOperationException {
throw new UnsupportedOperationException();
}
@Override
public void writeTo(OutputStream outputStream) throws IOException {
this.writer.accept(outputStream);
}
@Override
public boolean isStreaming() {
return true;
}
private int calculateStringContentLength() {
try {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
this.writer.accept(bytes);
return bytes.toByteArray().length;
}
catch (IOException ex) {
return -1;
}
}
@Override
public void close() throws IOException {
}
}
Domain
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free