alexandroid/decompiled/jadx/sources/org/apache/http/entity/StringEntity.java
KaKi87 a47fad5135 📦 Add decompiled Alexa 2.2.730155.0 (jadx, apktool, Hermes strings)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-07 00:04:16 +01:00

78 lines
2.6 KiB
Java

package org.apache.http.entity;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.UnsupportedCharsetException;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.Args;
/* compiled from: r8-map-id-b9432e0f623b4a4bff4ba50a8a24c4aafad2c1e11092747b9fb5e6a22af5a940 */
/* loaded from: classes11.dex */
public class StringEntity extends AbstractHttpEntity implements Cloneable {
protected final byte[] content;
@Deprecated
public StringEntity(String str, String str2, String str3) throws UnsupportedEncodingException {
Args.notNull(str, "Source string");
str2 = str2 == null ? "text/plain" : str2;
str3 = str3 == null ? "ISO-8859-1" : str3;
this.content = str.getBytes(str3);
setContentType(str2 + HTTP.CHARSET_PARAM + str3);
}
public Object clone() throws CloneNotSupportedException {
return super.clone();
}
@Override // org.apache.http.HttpEntity
public InputStream getContent() throws IOException {
return new ByteArrayInputStream(this.content);
}
@Override // org.apache.http.HttpEntity
public long getContentLength() {
return this.content.length;
}
@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");
outputStream.write(this.content);
outputStream.flush();
}
public StringEntity(String str, ContentType contentType) throws UnsupportedCharsetException {
Args.notNull(str, "Source string");
Charset charset = contentType != null ? contentType.getCharset() : null;
this.content = str.getBytes(charset == null ? HTTP.DEF_CONTENT_CHARSET : charset);
if (contentType != null) {
setContentType(contentType.toString());
}
}
public StringEntity(String str, String str2) throws UnsupportedCharsetException {
this(str, ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), str2));
}
public StringEntity(String str, Charset charset) {
this(str, ContentType.create(ContentType.TEXT_PLAIN.getMimeType(), charset));
}
public StringEntity(String str) throws UnsupportedEncodingException {
this(str, ContentType.DEFAULT_TEXT);
}
}