127 lines
4.9 KiB
Java
127 lines
4.9 KiB
Java
package com.liulishuo.filedownloader.message;
|
|
|
|
import android.os.Parcel;
|
|
import android.os.Parcelable;
|
|
import com.liulishuo.filedownloader.message.LargeMessageSnapshot;
|
|
import com.liulishuo.filedownloader.message.SmallMessageSnapshot;
|
|
import com.liulishuo.filedownloader.util.FileDownloadUtils;
|
|
|
|
/* loaded from: classes.dex */
|
|
public abstract class MessageSnapshot implements IMessageSnapshot, Parcelable {
|
|
public static final Parcelable.Creator<MessageSnapshot> CREATOR = new Parcelable.Creator<MessageSnapshot>() { // from class: com.liulishuo.filedownloader.message.MessageSnapshot.1
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public MessageSnapshot createFromParcel(Parcel parcel) {
|
|
boolean z = parcel.readByte() == 1;
|
|
byte readByte = parcel.readByte();
|
|
MessageSnapshot startedMessageSnapshot = readByte != -4 ? readByte != -3 ? readByte != -1 ? readByte != 1 ? readByte != 2 ? readByte != 3 ? readByte != 5 ? readByte != 6 ? null : new StartedMessageSnapshot(parcel) : z ? new LargeMessageSnapshot.RetryMessageSnapshot(parcel) : new SmallMessageSnapshot.RetryMessageSnapshot(parcel) : z ? new LargeMessageSnapshot.ProgressMessageSnapshot(parcel) : new SmallMessageSnapshot.ProgressMessageSnapshot(parcel) : z ? new LargeMessageSnapshot.ConnectedMessageSnapshot(parcel) : new SmallMessageSnapshot.ConnectedMessageSnapshot(parcel) : z ? new LargeMessageSnapshot.PendingMessageSnapshot(parcel) : new SmallMessageSnapshot.PendingMessageSnapshot(parcel) : z ? new LargeMessageSnapshot.ErrorMessageSnapshot(parcel) : new SmallMessageSnapshot.ErrorMessageSnapshot(parcel) : z ? new LargeMessageSnapshot.CompletedSnapshot(parcel) : new SmallMessageSnapshot.CompletedSnapshot(parcel) : z ? new LargeMessageSnapshot.WarnMessageSnapshot(parcel) : new SmallMessageSnapshot.WarnMessageSnapshot(parcel);
|
|
if (startedMessageSnapshot != null) {
|
|
startedMessageSnapshot.isLargeFile = z;
|
|
return startedMessageSnapshot;
|
|
}
|
|
throw new IllegalStateException("Can't restore the snapshot because unknown status: " + ((int) readByte));
|
|
}
|
|
|
|
/* JADX WARN: Can't rename method to resolve collision */
|
|
@Override // android.os.Parcelable.Creator
|
|
public MessageSnapshot[] newArray(int i) {
|
|
return new MessageSnapshot[i];
|
|
}
|
|
};
|
|
private final int id;
|
|
protected boolean isLargeFile;
|
|
|
|
public interface IWarnMessageSnapshot {
|
|
MessageSnapshot turnToPending();
|
|
}
|
|
|
|
public static class NoFieldException extends IllegalStateException {
|
|
NoFieldException(String str, MessageSnapshot messageSnapshot) {
|
|
super(FileDownloadUtils.a("There isn't a field for '%s' in this message %d %d %s", str, Integer.valueOf(messageSnapshot.getId()), Byte.valueOf(messageSnapshot.getStatus()), messageSnapshot.getClass().getName()));
|
|
}
|
|
}
|
|
|
|
public static class StartedMessageSnapshot extends MessageSnapshot {
|
|
StartedMessageSnapshot(int i) {
|
|
super(i);
|
|
}
|
|
|
|
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
|
public byte getStatus() {
|
|
return (byte) 6;
|
|
}
|
|
|
|
StartedMessageSnapshot(Parcel parcel) {
|
|
super(parcel);
|
|
}
|
|
}
|
|
|
|
MessageSnapshot(int i) {
|
|
this.id = i;
|
|
}
|
|
|
|
public int describeContents() {
|
|
return 0;
|
|
}
|
|
|
|
public String getEtag() {
|
|
throw new NoFieldException("getEtag", this);
|
|
}
|
|
|
|
public String getFileName() {
|
|
throw new NoFieldException("getFileName", this);
|
|
}
|
|
|
|
public int getId() {
|
|
return this.id;
|
|
}
|
|
|
|
public long getLargeSofarBytes() {
|
|
throw new NoFieldException("getLargeSofarBytes", this);
|
|
}
|
|
|
|
public long getLargeTotalBytes() {
|
|
throw new NoFieldException("getLargeTotalBytes", this);
|
|
}
|
|
|
|
public int getRetryingTimes() {
|
|
throw new NoFieldException("getRetryingTimes", this);
|
|
}
|
|
|
|
public int getSmallSofarBytes() {
|
|
throw new NoFieldException("getSmallSofarBytes", this);
|
|
}
|
|
|
|
public int getSmallTotalBytes() {
|
|
throw new NoFieldException("getSmallTotalBytes", this);
|
|
}
|
|
|
|
public abstract /* synthetic */ byte getStatus();
|
|
|
|
public Throwable getThrowable() {
|
|
throw new NoFieldException("getThrowable", this);
|
|
}
|
|
|
|
public boolean isLargeFile() {
|
|
return this.isLargeFile;
|
|
}
|
|
|
|
public boolean isResuming() {
|
|
throw new NoFieldException("isResuming", this);
|
|
}
|
|
|
|
public boolean isReusedDownloadedFile() {
|
|
throw new NoFieldException("isReusedDownloadedFile", this);
|
|
}
|
|
|
|
public void writeToParcel(Parcel parcel, int i) {
|
|
parcel.writeByte(this.isLargeFile ? (byte) 1 : (byte) 0);
|
|
parcel.writeByte(getStatus());
|
|
parcel.writeInt(this.id);
|
|
}
|
|
|
|
MessageSnapshot(Parcel parcel) {
|
|
this.id = parcel.readInt();
|
|
}
|
|
}
|