Initial commit
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
package com.liulishuo.filedownloader.message;
|
||||
|
||||
import com.liulishuo.filedownloader.util.FileDownloadUtils;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface BlockCompleteMessage {
|
||||
|
||||
public static class BlockCompleteMessageImpl extends MessageSnapshot implements BlockCompleteMessage {
|
||||
private final MessageSnapshot mCompletedSnapshot;
|
||||
|
||||
public BlockCompleteMessageImpl(MessageSnapshot messageSnapshot) {
|
||||
super(messageSnapshot.getId());
|
||||
if (messageSnapshot.getStatus() != -3) {
|
||||
throw new IllegalArgumentException(FileDownloadUtils.a("can't create the block complete message for id[%d], status[%d]", Integer.valueOf(messageSnapshot.getId()), Byte.valueOf(messageSnapshot.getStatus())));
|
||||
}
|
||||
this.mCompletedSnapshot = messageSnapshot;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 4;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.BlockCompleteMessage
|
||||
public MessageSnapshot transmitToCompleted() {
|
||||
return this.mCompletedSnapshot;
|
||||
}
|
||||
}
|
||||
|
||||
MessageSnapshot transmitToCompleted();
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.liulishuo.filedownloader.message;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IFlowDirectly {
|
||||
}
|
@@ -0,0 +1,5 @@
|
||||
package com.liulishuo.filedownloader.message;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface IMessageSnapshot {
|
||||
}
|
@@ -0,0 +1,352 @@
|
||||
package com.liulishuo.filedownloader.message;
|
||||
|
||||
import android.os.Parcel;
|
||||
import com.liulishuo.filedownloader.message.MessageSnapshot;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class LargeMessageSnapshot extends MessageSnapshot {
|
||||
|
||||
public static class CompletedFlowDirectlySnapshot extends CompletedSnapshot implements IFlowDirectly {
|
||||
CompletedFlowDirectlySnapshot(int i, boolean z, long j) {
|
||||
super(i, z, j);
|
||||
}
|
||||
|
||||
CompletedFlowDirectlySnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PausedSnapshot extends PendingMessageSnapshot {
|
||||
PausedSnapshot(int i, long j, long j2) {
|
||||
super(i, j, j2);
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.LargeMessageSnapshot.PendingMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) -2;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PendingMessageSnapshot extends LargeMessageSnapshot {
|
||||
private final long sofarBytes;
|
||||
private final long totalBytes;
|
||||
|
||||
PendingMessageSnapshot(PendingMessageSnapshot pendingMessageSnapshot) {
|
||||
this(pendingMessageSnapshot.getId(), pendingMessageSnapshot.getLargeSofarBytes(), pendingMessageSnapshot.getLargeTotalBytes());
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public long getLargeSofarBytes() {
|
||||
return this.sofarBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public long getLargeTotalBytes() {
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 1;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeLong(this.sofarBytes);
|
||||
parcel.writeLong(this.totalBytes);
|
||||
}
|
||||
|
||||
PendingMessageSnapshot(int i, long j, long j2) {
|
||||
super(i);
|
||||
this.sofarBytes = j;
|
||||
this.totalBytes = j2;
|
||||
}
|
||||
|
||||
PendingMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.sofarBytes = parcel.readLong();
|
||||
this.totalBytes = parcel.readLong();
|
||||
}
|
||||
}
|
||||
|
||||
public static class WarnFlowDirectlySnapshot extends WarnMessageSnapshot implements IFlowDirectly {
|
||||
WarnFlowDirectlySnapshot(int i, long j, long j2) {
|
||||
super(i, j, j2);
|
||||
}
|
||||
|
||||
WarnFlowDirectlySnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
}
|
||||
|
||||
public static class WarnMessageSnapshot extends PendingMessageSnapshot implements MessageSnapshot.IWarnMessageSnapshot {
|
||||
WarnMessageSnapshot(int i, long j, long j2) {
|
||||
super(i, j, j2);
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.LargeMessageSnapshot.PendingMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) -4;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot.IWarnMessageSnapshot
|
||||
public MessageSnapshot turnToPending() {
|
||||
return new PendingMessageSnapshot(this);
|
||||
}
|
||||
|
||||
WarnMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
}
|
||||
|
||||
LargeMessageSnapshot(int i) {
|
||||
super(i);
|
||||
this.isLargeFile = true;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getSmallSofarBytes() {
|
||||
if (getLargeSofarBytes() > 2147483647L) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return (int) getLargeSofarBytes();
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getSmallTotalBytes() {
|
||||
if (getLargeTotalBytes() > 2147483647L) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
return (int) getLargeTotalBytes();
|
||||
}
|
||||
|
||||
public static class ProgressMessageSnapshot extends LargeMessageSnapshot {
|
||||
private final long sofarBytes;
|
||||
|
||||
ProgressMessageSnapshot(int i, long j) {
|
||||
super(i);
|
||||
this.sofarBytes = j;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public long getLargeSofarBytes() {
|
||||
return this.sofarBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 3;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeLong(this.sofarBytes);
|
||||
}
|
||||
|
||||
ProgressMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.sofarBytes = parcel.readLong();
|
||||
}
|
||||
}
|
||||
|
||||
public static class RetryMessageSnapshot extends ErrorMessageSnapshot {
|
||||
private final int retryingTimes;
|
||||
|
||||
RetryMessageSnapshot(int i, long j, Throwable th, int i2) {
|
||||
super(i, j, th);
|
||||
this.retryingTimes = i2;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.LargeMessageSnapshot.ErrorMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getRetryingTimes() {
|
||||
return this.retryingTimes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.LargeMessageSnapshot.ErrorMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 5;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.LargeMessageSnapshot.ErrorMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeInt(this.retryingTimes);
|
||||
}
|
||||
|
||||
RetryMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.retryingTimes = parcel.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
public static class CompletedSnapshot extends LargeMessageSnapshot {
|
||||
private final boolean reusedDownloadedFile;
|
||||
private final long totalBytes;
|
||||
|
||||
CompletedSnapshot(int i, boolean z, long j) {
|
||||
super(i);
|
||||
this.reusedDownloadedFile = z;
|
||||
this.totalBytes = j;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public long getLargeTotalBytes() {
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) -3;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public boolean isReusedDownloadedFile() {
|
||||
return this.reusedDownloadedFile;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeByte(this.reusedDownloadedFile ? (byte) 1 : (byte) 0);
|
||||
parcel.writeLong(this.totalBytes);
|
||||
}
|
||||
|
||||
CompletedSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.reusedDownloadedFile = parcel.readByte() != 0;
|
||||
this.totalBytes = parcel.readLong();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ErrorMessageSnapshot extends LargeMessageSnapshot {
|
||||
private final long sofarBytes;
|
||||
private final Throwable throwable;
|
||||
|
||||
ErrorMessageSnapshot(int i, long j, Throwable th) {
|
||||
super(i);
|
||||
this.sofarBytes = j;
|
||||
this.throwable = th;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public long getLargeSofarBytes() {
|
||||
return this.sofarBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) -1;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public Throwable getThrowable() {
|
||||
return this.throwable;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeLong(this.sofarBytes);
|
||||
parcel.writeSerializable(this.throwable);
|
||||
}
|
||||
|
||||
ErrorMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.sofarBytes = parcel.readLong();
|
||||
this.throwable = (Throwable) parcel.readSerializable();
|
||||
}
|
||||
}
|
||||
|
||||
LargeMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
|
||||
public static class ConnectedMessageSnapshot extends LargeMessageSnapshot {
|
||||
private final String etag;
|
||||
private final String fileName;
|
||||
private final boolean resuming;
|
||||
private final long totalBytes;
|
||||
|
||||
ConnectedMessageSnapshot(int i, boolean z, long j, String str, String str2) {
|
||||
super(i);
|
||||
this.resuming = z;
|
||||
this.totalBytes = j;
|
||||
this.etag = str;
|
||||
this.fileName = str2;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public String getEtag() {
|
||||
return this.etag;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public String getFileName() {
|
||||
return this.fileName;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public long getLargeTotalBytes() {
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 2;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public boolean isResuming() {
|
||||
return this.resuming;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeByte(this.resuming ? (byte) 1 : (byte) 0);
|
||||
parcel.writeLong(this.totalBytes);
|
||||
parcel.writeString(this.etag);
|
||||
parcel.writeString(this.fileName);
|
||||
}
|
||||
|
||||
ConnectedMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.resuming = parcel.readByte() != 0;
|
||||
this.totalBytes = parcel.readLong();
|
||||
this.etag = parcel.readString();
|
||||
this.fileName = parcel.readString();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,126 @@
|
||||
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();
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.liulishuo.filedownloader.message;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MessageSnapshotFlow {
|
||||
private volatile MessageSnapshotThreadPool a;
|
||||
private volatile MessageReceiver b;
|
||||
|
||||
public static final class HolderClass {
|
||||
private static final MessageSnapshotFlow a = new MessageSnapshotFlow();
|
||||
}
|
||||
|
||||
public interface MessageReceiver {
|
||||
void a(MessageSnapshot messageSnapshot);
|
||||
}
|
||||
|
||||
public static MessageSnapshotFlow a() {
|
||||
return HolderClass.a;
|
||||
}
|
||||
|
||||
public void a(MessageReceiver messageReceiver) {
|
||||
this.b = messageReceiver;
|
||||
if (messageReceiver == null) {
|
||||
this.a = null;
|
||||
} else {
|
||||
this.a = new MessageSnapshotThreadPool(5, messageReceiver);
|
||||
}
|
||||
}
|
||||
|
||||
public void a(MessageSnapshot messageSnapshot) {
|
||||
if (messageSnapshot instanceof IFlowDirectly) {
|
||||
if (this.b != null) {
|
||||
this.b.a(messageSnapshot);
|
||||
}
|
||||
} else if (this.a != null) {
|
||||
this.a.a(messageSnapshot);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,116 @@
|
||||
package com.liulishuo.filedownloader.message;
|
||||
|
||||
import com.liulishuo.filedownloader.BaseDownloadTask;
|
||||
import com.liulishuo.filedownloader.download.DownloadStatusCallback;
|
||||
import com.liulishuo.filedownloader.message.BlockCompleteMessage;
|
||||
import com.liulishuo.filedownloader.message.LargeMessageSnapshot;
|
||||
import com.liulishuo.filedownloader.message.MessageSnapshot;
|
||||
import com.liulishuo.filedownloader.message.SmallMessageSnapshot;
|
||||
import com.liulishuo.filedownloader.model.FileDownloadModel;
|
||||
import com.liulishuo.filedownloader.util.FileDownloadLog;
|
||||
import com.liulishuo.filedownloader.util.FileDownloadUtils;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MessageSnapshotTaker {
|
||||
public static MessageSnapshot a(int i, File file, boolean z) {
|
||||
long length = file.length();
|
||||
return length > 2147483647L ? z ? new LargeMessageSnapshot.CompletedFlowDirectlySnapshot(i, true, length) : new LargeMessageSnapshot.CompletedSnapshot(i, true, length) : z ? new SmallMessageSnapshot.CompletedFlowDirectlySnapshot(i, true, (int) length) : new SmallMessageSnapshot.CompletedSnapshot(i, true, (int) length);
|
||||
}
|
||||
|
||||
public static MessageSnapshot a(int i, long j, long j2, boolean z) {
|
||||
if (j2 > 2147483647L) {
|
||||
if (z) {
|
||||
return new LargeMessageSnapshot.WarnFlowDirectlySnapshot(i, j, j2);
|
||||
}
|
||||
return new LargeMessageSnapshot.WarnMessageSnapshot(i, j, j2);
|
||||
}
|
||||
if (z) {
|
||||
return new SmallMessageSnapshot.WarnFlowDirectlySnapshot(i, (int) j, (int) j2);
|
||||
}
|
||||
return new SmallMessageSnapshot.WarnMessageSnapshot(i, (int) j, (int) j2);
|
||||
}
|
||||
|
||||
public static MessageSnapshot a(int i, long j, Throwable th) {
|
||||
if (j > 2147483647L) {
|
||||
return new LargeMessageSnapshot.ErrorMessageSnapshot(i, j, th);
|
||||
}
|
||||
return new SmallMessageSnapshot.ErrorMessageSnapshot(i, (int) j, th);
|
||||
}
|
||||
|
||||
public static MessageSnapshot a(BaseDownloadTask baseDownloadTask) {
|
||||
if (baseDownloadTask.e()) {
|
||||
return new LargeMessageSnapshot.PausedSnapshot(baseDownloadTask.getId(), baseDownloadTask.l(), baseDownloadTask.t());
|
||||
}
|
||||
return new SmallMessageSnapshot.PausedSnapshot(baseDownloadTask.getId(), baseDownloadTask.r(), baseDownloadTask.f());
|
||||
}
|
||||
|
||||
public static MessageSnapshot a(MessageSnapshot messageSnapshot) {
|
||||
if (messageSnapshot.getStatus() == -3) {
|
||||
return new BlockCompleteMessage.BlockCompleteMessageImpl(messageSnapshot);
|
||||
}
|
||||
throw new IllegalStateException(FileDownloadUtils.a("take block completed snapshot, must has already be completed. %d %d", Integer.valueOf(messageSnapshot.getId()), Byte.valueOf(messageSnapshot.getStatus())));
|
||||
}
|
||||
|
||||
public static MessageSnapshot a(byte b, FileDownloadModel fileDownloadModel, DownloadStatusCallback.ProcessParams processParams) {
|
||||
MessageSnapshot errorMessageSnapshot;
|
||||
IllegalStateException illegalStateException;
|
||||
int id = fileDownloadModel.getId();
|
||||
if (b == -4) {
|
||||
throw new IllegalStateException(FileDownloadUtils.a("please use #catchWarn instead %d", Integer.valueOf(id)));
|
||||
}
|
||||
if (b == -3) {
|
||||
if (fileDownloadModel.isLargeFile()) {
|
||||
return new LargeMessageSnapshot.CompletedSnapshot(id, false, fileDownloadModel.getTotal());
|
||||
}
|
||||
return new SmallMessageSnapshot.CompletedSnapshot(id, false, (int) fileDownloadModel.getTotal());
|
||||
}
|
||||
if (b != -1) {
|
||||
if (b != 1) {
|
||||
if (b == 2) {
|
||||
String filename = fileDownloadModel.isPathAsDirectory() ? fileDownloadModel.getFilename() : null;
|
||||
if (fileDownloadModel.isLargeFile()) {
|
||||
return new LargeMessageSnapshot.ConnectedMessageSnapshot(id, processParams.c(), fileDownloadModel.getTotal(), fileDownloadModel.getETag(), filename);
|
||||
}
|
||||
return new SmallMessageSnapshot.ConnectedMessageSnapshot(id, processParams.c(), (int) fileDownloadModel.getTotal(), fileDownloadModel.getETag(), filename);
|
||||
}
|
||||
if (b == 3) {
|
||||
if (fileDownloadModel.isLargeFile()) {
|
||||
return new LargeMessageSnapshot.ProgressMessageSnapshot(id, fileDownloadModel.getSoFar());
|
||||
}
|
||||
return new SmallMessageSnapshot.ProgressMessageSnapshot(id, (int) fileDownloadModel.getSoFar());
|
||||
}
|
||||
if (b != 5) {
|
||||
if (b != 6) {
|
||||
String a = FileDownloadUtils.a("it can't takes a snapshot for the task(%s) when its status is %d,", fileDownloadModel, Byte.valueOf(b));
|
||||
FileDownloadLog.e(MessageSnapshotTaker.class, "it can't takes a snapshot for the task(%s) when its status is %d,", fileDownloadModel, Byte.valueOf(b));
|
||||
if (processParams.a() != null) {
|
||||
illegalStateException = new IllegalStateException(a, processParams.a());
|
||||
} else {
|
||||
illegalStateException = new IllegalStateException(a);
|
||||
}
|
||||
if (fileDownloadModel.isLargeFile()) {
|
||||
return new LargeMessageSnapshot.ErrorMessageSnapshot(id, fileDownloadModel.getSoFar(), illegalStateException);
|
||||
}
|
||||
return new SmallMessageSnapshot.ErrorMessageSnapshot(id, (int) fileDownloadModel.getSoFar(), illegalStateException);
|
||||
}
|
||||
return new MessageSnapshot.StartedMessageSnapshot(id);
|
||||
}
|
||||
if (fileDownloadModel.isLargeFile()) {
|
||||
errorMessageSnapshot = new LargeMessageSnapshot.RetryMessageSnapshot(id, fileDownloadModel.getSoFar(), processParams.a(), processParams.b());
|
||||
} else {
|
||||
errorMessageSnapshot = new SmallMessageSnapshot.RetryMessageSnapshot(id, (int) fileDownloadModel.getSoFar(), processParams.a(), processParams.b());
|
||||
}
|
||||
} else if (fileDownloadModel.isLargeFile()) {
|
||||
errorMessageSnapshot = new LargeMessageSnapshot.PendingMessageSnapshot(id, fileDownloadModel.getSoFar(), fileDownloadModel.getTotal());
|
||||
} else {
|
||||
return new SmallMessageSnapshot.PendingMessageSnapshot(id, (int) fileDownloadModel.getSoFar(), (int) fileDownloadModel.getTotal());
|
||||
}
|
||||
} else if (fileDownloadModel.isLargeFile()) {
|
||||
errorMessageSnapshot = new LargeMessageSnapshot.ErrorMessageSnapshot(id, fileDownloadModel.getSoFar(), processParams.a());
|
||||
} else {
|
||||
errorMessageSnapshot = new SmallMessageSnapshot.ErrorMessageSnapshot(id, (int) fileDownloadModel.getSoFar(), processParams.a());
|
||||
}
|
||||
return errorMessageSnapshot;
|
||||
}
|
||||
}
|
@@ -0,0 +1,84 @@
|
||||
package com.liulishuo.filedownloader.message;
|
||||
|
||||
import com.liulishuo.filedownloader.message.MessageSnapshotFlow;
|
||||
import com.liulishuo.filedownloader.util.FileDownloadExecutors;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class MessageSnapshotThreadPool {
|
||||
private final List<FlowSingleExecutor> a = new ArrayList();
|
||||
private final MessageSnapshotFlow.MessageReceiver b;
|
||||
|
||||
public class FlowSingleExecutor {
|
||||
private final List<Integer> a = new ArrayList();
|
||||
private final Executor b;
|
||||
|
||||
public FlowSingleExecutor(int i) {
|
||||
this.b = FileDownloadExecutors.a(1, "Flow-" + i);
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
this.a.add(Integer.valueOf(i));
|
||||
}
|
||||
|
||||
public void a(final MessageSnapshot messageSnapshot) {
|
||||
this.b.execute(new Runnable() { // from class: com.liulishuo.filedownloader.message.MessageSnapshotThreadPool.FlowSingleExecutor.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
MessageSnapshotThreadPool.this.b.a(messageSnapshot);
|
||||
FlowSingleExecutor.this.a.remove(Integer.valueOf(messageSnapshot.getId()));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
MessageSnapshotThreadPool(int i, MessageSnapshotFlow.MessageReceiver messageReceiver) {
|
||||
this.b = messageReceiver;
|
||||
for (int i2 = 0; i2 < i; i2++) {
|
||||
this.a.add(new FlowSingleExecutor(i2));
|
||||
}
|
||||
}
|
||||
|
||||
public void a(MessageSnapshot messageSnapshot) {
|
||||
FlowSingleExecutor flowSingleExecutor = null;
|
||||
try {
|
||||
synchronized (this.a) {
|
||||
int id = messageSnapshot.getId();
|
||||
Iterator<FlowSingleExecutor> it = this.a.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
FlowSingleExecutor next = it.next();
|
||||
if (next.a.contains(Integer.valueOf(id))) {
|
||||
flowSingleExecutor = next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flowSingleExecutor == null) {
|
||||
int i = 0;
|
||||
Iterator<FlowSingleExecutor> it2 = this.a.iterator();
|
||||
while (true) {
|
||||
if (!it2.hasNext()) {
|
||||
break;
|
||||
}
|
||||
FlowSingleExecutor next2 = it2.next();
|
||||
if (next2.a.size() <= 0) {
|
||||
flowSingleExecutor = next2;
|
||||
break;
|
||||
} else if (i == 0 || next2.a.size() < i) {
|
||||
i = next2.a.size();
|
||||
flowSingleExecutor = next2;
|
||||
}
|
||||
}
|
||||
}
|
||||
flowSingleExecutor.a(id);
|
||||
}
|
||||
} finally {
|
||||
flowSingleExecutor.a(messageSnapshot);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,341 @@
|
||||
package com.liulishuo.filedownloader.message;
|
||||
|
||||
import android.os.Parcel;
|
||||
import com.liulishuo.filedownloader.message.MessageSnapshot;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class SmallMessageSnapshot extends MessageSnapshot {
|
||||
|
||||
public static class CompletedFlowDirectlySnapshot extends CompletedSnapshot implements IFlowDirectly {
|
||||
CompletedFlowDirectlySnapshot(int i, boolean z, int i2) {
|
||||
super(i, z, i2);
|
||||
}
|
||||
|
||||
CompletedFlowDirectlySnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
}
|
||||
|
||||
public static class PausedSnapshot extends PendingMessageSnapshot {
|
||||
PausedSnapshot(int i, int i2, int i3) {
|
||||
super(i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.SmallMessageSnapshot.PendingMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) -2;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PendingMessageSnapshot extends SmallMessageSnapshot {
|
||||
private final int sofarBytes;
|
||||
private final int totalBytes;
|
||||
|
||||
PendingMessageSnapshot(PendingMessageSnapshot pendingMessageSnapshot) {
|
||||
this(pendingMessageSnapshot.getId(), pendingMessageSnapshot.getSmallSofarBytes(), pendingMessageSnapshot.getSmallTotalBytes());
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getSmallSofarBytes() {
|
||||
return this.sofarBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getSmallTotalBytes() {
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 1;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeInt(this.sofarBytes);
|
||||
parcel.writeInt(this.totalBytes);
|
||||
}
|
||||
|
||||
PendingMessageSnapshot(int i, int i2, int i3) {
|
||||
super(i);
|
||||
this.sofarBytes = i2;
|
||||
this.totalBytes = i3;
|
||||
}
|
||||
|
||||
PendingMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.sofarBytes = parcel.readInt();
|
||||
this.totalBytes = parcel.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
public static class WarnFlowDirectlySnapshot extends WarnMessageSnapshot implements IFlowDirectly {
|
||||
WarnFlowDirectlySnapshot(int i, int i2, int i3) {
|
||||
super(i, i2, i3);
|
||||
}
|
||||
|
||||
WarnFlowDirectlySnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
}
|
||||
|
||||
public static class WarnMessageSnapshot extends PendingMessageSnapshot implements MessageSnapshot.IWarnMessageSnapshot {
|
||||
WarnMessageSnapshot(int i, int i2, int i3) {
|
||||
super(i, i2, i3);
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.SmallMessageSnapshot.PendingMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) -4;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot.IWarnMessageSnapshot
|
||||
public MessageSnapshot turnToPending() {
|
||||
return new PendingMessageSnapshot(this);
|
||||
}
|
||||
|
||||
WarnMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
}
|
||||
|
||||
SmallMessageSnapshot(int i) {
|
||||
super(i);
|
||||
this.isLargeFile = false;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public long getLargeSofarBytes() {
|
||||
return getSmallSofarBytes();
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public long getLargeTotalBytes() {
|
||||
return getSmallTotalBytes();
|
||||
}
|
||||
|
||||
public static class ProgressMessageSnapshot extends SmallMessageSnapshot {
|
||||
private final int sofarBytes;
|
||||
|
||||
ProgressMessageSnapshot(int i, int i2) {
|
||||
super(i);
|
||||
this.sofarBytes = i2;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getSmallSofarBytes() {
|
||||
return this.sofarBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 3;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeInt(this.sofarBytes);
|
||||
}
|
||||
|
||||
ProgressMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.sofarBytes = parcel.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
public static class RetryMessageSnapshot extends ErrorMessageSnapshot {
|
||||
private final int retryingTimes;
|
||||
|
||||
RetryMessageSnapshot(int i, int i2, Throwable th, int i3) {
|
||||
super(i, i2, th);
|
||||
this.retryingTimes = i3;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.SmallMessageSnapshot.ErrorMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getRetryingTimes() {
|
||||
return this.retryingTimes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.SmallMessageSnapshot.ErrorMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 5;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.SmallMessageSnapshot.ErrorMessageSnapshot, com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeInt(this.retryingTimes);
|
||||
}
|
||||
|
||||
RetryMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.retryingTimes = parcel.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
public static class CompletedSnapshot extends SmallMessageSnapshot {
|
||||
private final boolean reusedDownloadedFile;
|
||||
private final int totalBytes;
|
||||
|
||||
CompletedSnapshot(int i, boolean z, int i2) {
|
||||
super(i);
|
||||
this.reusedDownloadedFile = z;
|
||||
this.totalBytes = i2;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getSmallTotalBytes() {
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) -3;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public boolean isReusedDownloadedFile() {
|
||||
return this.reusedDownloadedFile;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeByte(this.reusedDownloadedFile ? (byte) 1 : (byte) 0);
|
||||
parcel.writeInt(this.totalBytes);
|
||||
}
|
||||
|
||||
CompletedSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.reusedDownloadedFile = parcel.readByte() != 0;
|
||||
this.totalBytes = parcel.readInt();
|
||||
}
|
||||
}
|
||||
|
||||
public static class ErrorMessageSnapshot extends SmallMessageSnapshot {
|
||||
private final int sofarBytes;
|
||||
private final Throwable throwable;
|
||||
|
||||
ErrorMessageSnapshot(int i, int i2, Throwable th) {
|
||||
super(i);
|
||||
this.sofarBytes = i2;
|
||||
this.throwable = th;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getSmallSofarBytes() {
|
||||
return this.sofarBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) -1;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public Throwable getThrowable() {
|
||||
return this.throwable;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeInt(this.sofarBytes);
|
||||
parcel.writeSerializable(this.throwable);
|
||||
}
|
||||
|
||||
ErrorMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.sofarBytes = parcel.readInt();
|
||||
this.throwable = (Throwable) parcel.readSerializable();
|
||||
}
|
||||
}
|
||||
|
||||
SmallMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
}
|
||||
|
||||
public static class ConnectedMessageSnapshot extends SmallMessageSnapshot {
|
||||
private final String etag;
|
||||
private final String fileName;
|
||||
private final boolean resuming;
|
||||
private final int totalBytes;
|
||||
|
||||
ConnectedMessageSnapshot(int i, boolean z, int i2, String str, String str2) {
|
||||
super(i);
|
||||
this.resuming = z;
|
||||
this.totalBytes = i2;
|
||||
this.etag = str;
|
||||
this.fileName = str2;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public String getEtag() {
|
||||
return this.etag;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public String getFileName() {
|
||||
return this.fileName;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public int getSmallTotalBytes() {
|
||||
return this.totalBytes;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public byte getStatus() {
|
||||
return (byte) 2;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot
|
||||
public boolean isResuming() {
|
||||
return this.resuming;
|
||||
}
|
||||
|
||||
@Override // com.liulishuo.filedownloader.message.MessageSnapshot, android.os.Parcelable
|
||||
public void writeToParcel(Parcel parcel, int i) {
|
||||
super.writeToParcel(parcel, i);
|
||||
parcel.writeByte(this.resuming ? (byte) 1 : (byte) 0);
|
||||
parcel.writeInt(this.totalBytes);
|
||||
parcel.writeString(this.etag);
|
||||
parcel.writeString(this.fileName);
|
||||
}
|
||||
|
||||
ConnectedMessageSnapshot(Parcel parcel) {
|
||||
super(parcel);
|
||||
this.resuming = parcel.readByte() != 0;
|
||||
this.totalBytes = parcel.readInt();
|
||||
this.etag = parcel.readString();
|
||||
this.fileName = parcel.readString();
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user