ProgressReportingInputStream.smali
.class public Lcom/amazonaws/event/ProgressReportingInputStream;
.super Lcom/amazonaws/internal/SdkFilterInputStream;
.source "ProgressReportingInputStream.java"
# static fields
.field private static final BYTES_IN_KB:I = 0x400
.field private static final THRESHOLD_IN_KB:I = 0x8
# instance fields
.field private fireCompletedEvent:Z
.field private final listenerCallbackExecutor:Lcom/amazonaws/event/ProgressListenerCallbackExecutor;
.field private notificationThreshold:I
.field private unnotifiedByteCount:I
# direct methods
.method public constructor <init>(Ljava/io/InputStream;Lcom/amazonaws/event/ProgressListenerCallbackExecutor;)V
.registers 3
.line 1
invoke-direct {p0, p1}, Lcom/amazonaws/internal/SdkFilterInputStream;-><init>(Ljava/io/InputStream;)V
const/16 p1, 0x2000
.line 2
iput p1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->notificationThreshold:I
.line 3
iput-object p2, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->listenerCallbackExecutor:Lcom/amazonaws/event/ProgressListenerCallbackExecutor;
return-void
.end method
.method private notify(I)V
.registers 6
.line 1
iget v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
add-int/2addr v0, p1
iput v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
.line 2
iget p1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
iget v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->notificationThreshold:I
if-lt p1, v0, :cond_19
.line 3
iget-object v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->listenerCallbackExecutor:Lcom/amazonaws/event/ProgressListenerCallbackExecutor;
new-instance v1, Lcom/amazonaws/event/ProgressEvent;
int-to-long v2, p1
invoke-direct {v1, v2, v3}, Lcom/amazonaws/event/ProgressEvent;-><init>(J)V
invoke-virtual {v0, v1}, Lcom/amazonaws/event/ProgressListenerCallbackExecutor;->progressChanged(Lcom/amazonaws/event/ProgressEvent;)V
const/4 p1, 0x0
.line 4
iput p1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
:cond_19
return-void
.end method
.method private notifyCompleted()V
.registers 4
.line 1
iget-boolean v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->fireCompletedEvent:Z
if-nez v0, :cond_5
return-void
.line 2
:cond_5
new-instance v0, Lcom/amazonaws/event/ProgressEvent;
iget v1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
int-to-long v1, v1
invoke-direct {v0, v1, v2}, Lcom/amazonaws/event/ProgressEvent;-><init>(J)V
const/4 v1, 0x4
.line 3
invoke-virtual {v0, v1}, Lcom/amazonaws/event/ProgressEvent;->setEventCode(I)V
const/4 v1, 0x0
.line 4
iput v1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
.line 5
iget-object v1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->listenerCallbackExecutor:Lcom/amazonaws/event/ProgressListenerCallbackExecutor;
invoke-virtual {v1, v0}, Lcom/amazonaws/event/ProgressListenerCallbackExecutor;->progressChanged(Lcom/amazonaws/event/ProgressEvent;)V
return-void
.end method
# virtual methods
.method public close()V
.registers 6
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
iget v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
if-lez v0, :cond_12
.line 2
iget-object v1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->listenerCallbackExecutor:Lcom/amazonaws/event/ProgressListenerCallbackExecutor;
new-instance v2, Lcom/amazonaws/event/ProgressEvent;
int-to-long v3, v0
invoke-direct {v2, v3, v4}, Lcom/amazonaws/event/ProgressEvent;-><init>(J)V
invoke-virtual {v1, v2}, Lcom/amazonaws/event/ProgressListenerCallbackExecutor;->progressChanged(Lcom/amazonaws/event/ProgressEvent;)V
const/4 v0, 0x0
.line 3
iput v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
.line 4
:cond_12
invoke-super {p0}, Lcom/amazonaws/internal/SdkFilterInputStream;->close()V
return-void
.end method
.method public getFireCompletedEvent()Z
.registers 2
.line 1
iget-boolean v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->fireCompletedEvent:Z
return v0
.end method
.method public read()I
.registers 3
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-super {p0}, Lcom/amazonaws/internal/SdkFilterInputStream;->read()I
move-result v0
const/4 v1, -0x1
if-ne v0, v1, :cond_b
.line 2
invoke-direct {p0}, Lcom/amazonaws/event/ProgressReportingInputStream;->notifyCompleted()V
goto :goto_f
:cond_b
const/4 v1, 0x1
.line 3
invoke-direct {p0, v1}, Lcom/amazonaws/event/ProgressReportingInputStream;->notify(I)V
:goto_f
return v0
.end method
.method public read([BII)I
.registers 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 4
invoke-super {p0, p1, p2, p3}, Lcom/amazonaws/internal/SdkFilterInputStream;->read([BII)I
move-result p1
const/4 p2, -0x1
if-ne p1, p2, :cond_a
.line 5
invoke-direct {p0}, Lcom/amazonaws/event/ProgressReportingInputStream;->notifyCompleted()V
:cond_a
if-eq p1, p2, :cond_f
.line 6
invoke-direct {p0, p1}, Lcom/amazonaws/event/ProgressReportingInputStream;->notify(I)V
:cond_f
return p1
.end method
.method public reset()V
.registers 4
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/io/IOException;
}
.end annotation
.line 1
invoke-super {p0}, Lcom/amazonaws/internal/SdkFilterInputStream;->reset()V
.line 2
new-instance v0, Lcom/amazonaws/event/ProgressEvent;
iget v1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
int-to-long v1, v1
invoke-direct {v0, v1, v2}, Lcom/amazonaws/event/ProgressEvent;-><init>(J)V
const/16 v1, 0x20
.line 3
invoke-virtual {v0, v1}, Lcom/amazonaws/event/ProgressEvent;->setEventCode(I)V
.line 4
iget-object v1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->listenerCallbackExecutor:Lcom/amazonaws/event/ProgressListenerCallbackExecutor;
invoke-virtual {v1, v0}, Lcom/amazonaws/event/ProgressListenerCallbackExecutor;->progressChanged(Lcom/amazonaws/event/ProgressEvent;)V
const/4 v0, 0x0
.line 5
iput v0, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->unnotifiedByteCount:I
return-void
.end method
.method public setFireCompletedEvent(Z)V
.registers 2
.line 1
iput-boolean p1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->fireCompletedEvent:Z
return-void
.end method
.method public setNotificationThreshold(I)V
.registers 2
mul-int/lit16 p1, p1, 0x400
.line 1
iput p1, p0, Lcom/amazonaws/event/ProgressReportingInputStream;->notificationThreshold:I
return-void
.end method