mirror of
https://github.com/VibedByKaKi/alexandroid.git
synced 2026-11-29 09:13:24 +01:00
46 lines
1.5 KiB
Java
46 lines
1.5 KiB
Java
package org.apache.http.entity;
|
|
|
|
import java.io.ByteArrayInputStream;
|
|
import java.io.ByteArrayOutputStream;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import org.apache.http.util.Args;
|
|
|
|
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
|
|
/* loaded from: classes11.dex */
|
|
public class EntityTemplate extends AbstractHttpEntity {
|
|
private final ContentProducer contentproducer;
|
|
|
|
public EntityTemplate(ContentProducer contentProducer) {
|
|
this.contentproducer = (ContentProducer) Args.notNull(contentProducer, "Content producer");
|
|
}
|
|
|
|
@Override // org.apache.http.HttpEntity
|
|
public InputStream getContent() throws IOException {
|
|
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
|
writeTo(byteArrayOutputStream);
|
|
return new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
|
}
|
|
|
|
@Override // org.apache.http.HttpEntity
|
|
public long getContentLength() {
|
|
return -1L;
|
|
}
|
|
|
|
@Override // org.apache.http.HttpEntity
|
|
public boolean isRepeatable() {
|
|
return true;
|
|
}
|
|
|
|
@Override // org.apache.http.HttpEntity
|
|
public boolean isStreaming() {
|
|
return false;
|
|
}
|
|
|
|
@Override // org.apache.http.HttpEntity
|
|
public void writeTo(OutputStream outputStream) throws IOException {
|
|
Args.notNull(outputStream, "Output stream");
|
|
this.contentproducer.writeTo(outputStream);
|
|
}
|
|
}
|