122 lines
4.3 KiB
Java
122 lines
4.3 KiB
Java
|
package o;
|
||
|
|
||
|
import com.google.common.primitives.UnsignedBytes;
|
||
|
import java.io.DataInput;
|
||
|
import java.io.DataOutput;
|
||
|
import java.io.Externalizable;
|
||
|
import java.io.IOException;
|
||
|
import java.io.InvalidClassException;
|
||
|
import java.io.ObjectInput;
|
||
|
import java.io.ObjectOutput;
|
||
|
import java.io.StreamCorruptedException;
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
/* loaded from: classes6.dex */
|
||
|
public final class gtU implements Externalizable {
|
||
|
static final byte SZR = 1;
|
||
|
static final byte ZOT = 2;
|
||
|
static final byte ZOTRULE = 3;
|
||
|
private static final long serialVersionUID = -8885321777449118786L;
|
||
|
private Object object;
|
||
|
private byte type;
|
||
|
|
||
|
public gtU() {
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public gtU(byte b, Object obj) {
|
||
|
this.type = b;
|
||
|
this.object = obj;
|
||
|
}
|
||
|
|
||
|
@Override // java.io.Externalizable
|
||
|
public final void writeExternal(ObjectOutput objectOutput) throws IOException {
|
||
|
writeInternal(this.type, this.object, objectOutput);
|
||
|
}
|
||
|
|
||
|
static void write(Object obj, DataOutput dataOutput) throws IOException {
|
||
|
writeInternal((byte) 1, obj, dataOutput);
|
||
|
}
|
||
|
|
||
|
private static void writeInternal(byte b, Object obj, DataOutput dataOutput) throws IOException {
|
||
|
dataOutput.writeByte(b);
|
||
|
if (b == 1) {
|
||
|
((C15538gtR) obj).writeExternal(dataOutput);
|
||
|
} else if (b == 2) {
|
||
|
((gtW) obj).writeExternal(dataOutput);
|
||
|
} else {
|
||
|
if (b == 3) {
|
||
|
((gtX) obj).writeExternal(dataOutput);
|
||
|
return;
|
||
|
}
|
||
|
throw new InvalidClassException("Unknown serialized type");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // java.io.Externalizable
|
||
|
public final void readExternal(ObjectInput objectInput) throws IOException, ClassNotFoundException {
|
||
|
byte readByte = objectInput.readByte();
|
||
|
this.type = readByte;
|
||
|
this.object = readInternal(readByte, objectInput);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static Object read(DataInput dataInput) throws IOException, ClassNotFoundException {
|
||
|
return readInternal(dataInput.readByte(), dataInput);
|
||
|
}
|
||
|
|
||
|
private static Object readInternal(byte b, DataInput dataInput) throws IOException, ClassNotFoundException {
|
||
|
if (b == 1) {
|
||
|
return C15538gtR.readExternal(dataInput);
|
||
|
}
|
||
|
if (b == 2) {
|
||
|
return gtW.readExternal(dataInput);
|
||
|
}
|
||
|
if (b == 3) {
|
||
|
return gtX.readExternal(dataInput);
|
||
|
}
|
||
|
throw new StreamCorruptedException("Unknown serialized type");
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static void writeOffset(gsI gsi, DataOutput dataOutput) throws IOException {
|
||
|
int totalSeconds = gsi.getTotalSeconds();
|
||
|
int i = totalSeconds % 900 == 0 ? totalSeconds / 900 : 127;
|
||
|
dataOutput.writeByte(i);
|
||
|
if (i == 127) {
|
||
|
dataOutput.writeInt(totalSeconds);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static gsI readOffset(DataInput dataInput) throws IOException {
|
||
|
byte readByte = dataInput.readByte();
|
||
|
return readByte == Byte.MAX_VALUE ? gsI.ofTotalSeconds(dataInput.readInt()) : gsI.ofTotalSeconds(readByte * 900);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static void writeEpochSec(long j, DataOutput dataOutput) throws IOException {
|
||
|
if (j >= -4575744000L && j < 10413792000L && j % 900 == 0) {
|
||
|
int i = (int) ((j + 4575744000L) / 900);
|
||
|
dataOutput.writeByte((i >>> 16) & 255);
|
||
|
dataOutput.writeByte((i >>> 8) & 255);
|
||
|
dataOutput.writeByte(i & 255);
|
||
|
return;
|
||
|
}
|
||
|
dataOutput.writeByte(255);
|
||
|
dataOutput.writeLong(j);
|
||
|
}
|
||
|
|
||
|
/* JADX INFO: Access modifiers changed from: package-private */
|
||
|
public static long readEpochSec(DataInput dataInput) throws IOException {
|
||
|
if ((dataInput.readByte() & UnsignedBytes.MAX_VALUE) == 255) {
|
||
|
return dataInput.readLong();
|
||
|
}
|
||
|
return ((((r0 << 16) + ((dataInput.readByte() & UnsignedBytes.MAX_VALUE) << 8)) + (dataInput.readByte() & UnsignedBytes.MAX_VALUE)) * 900) - 4575744000L;
|
||
|
}
|
||
|
|
||
|
private Object readResolve() {
|
||
|
return this.object;
|
||
|
}
|
||
|
}
|