114 lines
4.3 KiB
Java
114 lines
4.3 KiB
Java
|
package o;
|
||
|
|
||
|
import java.io.DataInput;
|
||
|
import java.io.DataOutput;
|
||
|
import java.io.IOException;
|
||
|
import java.io.InvalidObjectException;
|
||
|
import java.io.ObjectStreamException;
|
||
|
import java.io.Serializable;
|
||
|
import java.util.regex.Pattern;
|
||
|
import org.threeten.bp.DateTimeException;
|
||
|
import org.threeten.bp.zone.ZoneRulesException;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes.dex */
|
||
|
public final class gsE extends AbstractC15502gsH implements Serializable {
|
||
|
private static final Pattern PATTERN = Pattern.compile("[A-Za-z][A-Za-z0-9~/._+-]+");
|
||
|
private static final long serialVersionUID = 8386373296231747096L;
|
||
|
private final String id;
|
||
|
private final transient AbstractC15574gua rules;
|
||
|
|
||
|
private static gsE ofLenient(String str) {
|
||
|
if (str.equals("Z") || str.startsWith("+") || str.startsWith("-")) {
|
||
|
throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: ".concat(String.valueOf(str)));
|
||
|
}
|
||
|
if (str.equals("UTC") || str.equals("GMT") || str.equals("UT")) {
|
||
|
return new gsE(str, gsI.UTC.getRules());
|
||
|
}
|
||
|
if (str.startsWith("UTC+") || str.startsWith("GMT+") || str.startsWith("UTC-") || str.startsWith("GMT-")) {
|
||
|
gsI of = gsI.of(str.substring(3));
|
||
|
if (of.getTotalSeconds() == 0) {
|
||
|
return new gsE(str.substring(0, 3), of.getRules());
|
||
|
}
|
||
|
StringBuilder sb = new StringBuilder();
|
||
|
sb.append(str.substring(0, 3));
|
||
|
sb.append(of.getId());
|
||
|
return new gsE(sb.toString(), of.getRules());
|
||
|
}
|
||
|
if (str.startsWith("UT+") || str.startsWith("UT-")) {
|
||
|
gsI of2 = gsI.of(str.substring(2));
|
||
|
if (of2.getTotalSeconds() == 0) {
|
||
|
return new gsE("UT", of2.getRules());
|
||
|
}
|
||
|
StringBuilder sb2 = new StringBuilder("UT");
|
||
|
sb2.append(of2.getId());
|
||
|
return new gsE(sb2.toString(), of2.getRules());
|
||
|
}
|
||
|
return ofId(str, false);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static gsE ofId(String str, boolean z) {
|
||
|
AbstractC15574gua abstractC15574gua;
|
||
|
gtG.requireNonNull(str, "zoneId");
|
||
|
if (str.length() < 2 || !PATTERN.matcher(str).matches()) {
|
||
|
throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: ".concat(String.valueOf(str)));
|
||
|
}
|
||
|
try {
|
||
|
abstractC15574gua = AbstractC15576guc.getRules(str, true);
|
||
|
} catch (ZoneRulesException e) {
|
||
|
if (str.equals("GMT0")) {
|
||
|
abstractC15574gua = gsI.UTC.getRules();
|
||
|
} else {
|
||
|
if (z) {
|
||
|
throw e;
|
||
|
}
|
||
|
abstractC15574gua = null;
|
||
|
}
|
||
|
}
|
||
|
return new gsE(str, abstractC15574gua);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public gsE(String str, AbstractC15574gua abstractC15574gua) {
|
||
|
this.id = str;
|
||
|
this.rules = abstractC15574gua;
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC15502gsH
|
||
|
public final AbstractC15574gua getRules() {
|
||
|
AbstractC15574gua abstractC15574gua = this.rules;
|
||
|
return abstractC15574gua == null ? AbstractC15576guc.getRules(this.id, false) : abstractC15574gua;
|
||
|
}
|
||
|
|
||
|
private Object writeReplace() {
|
||
|
return new C15501gsD((byte) 7, this);
|
||
|
}
|
||
|
|
||
|
private Object readResolve() throws ObjectStreamException {
|
||
|
throw new InvalidObjectException("Deserialization via serialization delegate");
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
@Override // o.AbstractC15502gsH
|
||
|
public final void write(DataOutput dataOutput) throws IOException {
|
||
|
dataOutput.writeByte(7);
|
||
|
writeExternal(dataOutput);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public final void writeExternal(DataOutput dataOutput) throws IOException {
|
||
|
dataOutput.writeUTF(this.id);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static AbstractC15502gsH readExternal(DataInput dataInput) throws IOException {
|
||
|
return ofLenient(dataInput.readUTF());
|
||
|
}
|
||
|
|
||
|
@Override // o.AbstractC15502gsH
|
||
|
public final String getId() {
|
||
|
return this.id;
|
||
|
}
|
||
|
}
|