AbstractStream.smali

.class public abstract Lio/grpc/internal/AbstractStream;
.super Ljava/lang/Object;
.source "AbstractStream.java"

# interfaces
.implements Lio/grpc/internal/Stream;


# annotations
.annotation system Ldalvik/annotation/MemberClasses;
    value = {
        Lio/grpc/internal/AbstractStream$DeframerListener;,
        Lio/grpc/internal/AbstractStream$FramerSink;,
        Lio/grpc/internal/AbstractStream$Phase;
    }
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "<IdT:",
        "Ljava/lang/Object;",
        ">",
        "Ljava/lang/Object;",
        "Lio/grpc/internal/Stream;"
    }
.end annotation


# static fields
.field public static final DEFAULT_ONREADY_THRESHOLD:I = 0x8000


# instance fields
.field private allocated:Z

.field private final deframer:Lio/grpc/internal/MessageDeframer;

.field private final framer:Lio/grpc/internal/MessageFramer;

.field private inboundPhase:Lio/grpc/internal/AbstractStream$Phase;

.field private numSentBytesQueued:I

.field private final onReadyLock:Ljava/lang/Object;

.field private onReadyThreshold:I

.field private outboundPhase:Lio/grpc/internal/AbstractStream$Phase;


# direct methods
.method constructor <init>(Lio/grpc/internal/MessageFramer;Lio/grpc/internal/MessageDeframer;)V
    .registers 4

    .line 8
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 9
    sget-object v0, Lio/grpc/internal/AbstractStream$Phase;->HEADERS:Lio/grpc/internal/AbstractStream$Phase;

    iput-object v0, p0, Lio/grpc/internal/AbstractStream;->inboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    .line 10
    iput-object v0, p0, Lio/grpc/internal/AbstractStream;->outboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    const v0, 0x8000

    .line 11
    iput v0, p0, Lio/grpc/internal/AbstractStream;->onReadyThreshold:I

    .line 12
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lio/grpc/internal/AbstractStream;->onReadyLock:Ljava/lang/Object;

    .line 13
    iput-object p1, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    .line 14
    iput-object p2, p0, Lio/grpc/internal/AbstractStream;->deframer:Lio/grpc/internal/MessageDeframer;

    return-void
.end method

.method constructor <init>(Lio/grpc/internal/WritableBufferAllocator;I)V
    .registers 5

    .line 1
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 2
    sget-object v0, Lio/grpc/internal/AbstractStream$Phase;->HEADERS:Lio/grpc/internal/AbstractStream$Phase;

    iput-object v0, p0, Lio/grpc/internal/AbstractStream;->inboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    .line 3
    iput-object v0, p0, Lio/grpc/internal/AbstractStream;->outboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    const v0, 0x8000

    .line 4
    iput v0, p0, Lio/grpc/internal/AbstractStream;->onReadyThreshold:I

    .line 5
    new-instance v0, Ljava/lang/Object;

    invoke-direct {v0}, Ljava/lang/Object;-><init>()V

    iput-object v0, p0, Lio/grpc/internal/AbstractStream;->onReadyLock:Ljava/lang/Object;

    .line 6
    new-instance v0, Lio/grpc/internal/MessageFramer;

    new-instance v1, Lio/grpc/internal/AbstractStream$FramerSink;

    invoke-direct {v1, p0}, Lio/grpc/internal/AbstractStream$FramerSink;-><init>(Lio/grpc/internal/AbstractStream;)V

    invoke-direct {v0, v1, p1}, Lio/grpc/internal/MessageFramer;-><init>(Lio/grpc/internal/MessageFramer$Sink;Lio/grpc/internal/WritableBufferAllocator;)V

    iput-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    .line 7
    new-instance p1, Lio/grpc/internal/MessageDeframer;

    new-instance v0, Lio/grpc/internal/AbstractStream$DeframerListener;

    invoke-direct {v0, p0}, Lio/grpc/internal/AbstractStream$DeframerListener;-><init>(Lio/grpc/internal/AbstractStream;)V

    sget-object v1, Lio/grpc/Codec$Identity;->NONE:Lio/grpc/Codec;

    invoke-direct {p1, v0, v1, p2}, Lio/grpc/internal/MessageDeframer;-><init>(Lio/grpc/internal/MessageDeframer$Listener;Lio/grpc/Decompressor;I)V

    iput-object p1, p0, Lio/grpc/internal/AbstractStream;->deframer:Lio/grpc/internal/MessageDeframer;

    return-void
.end method


# virtual methods
.method public canReceive()Z
    .registers 3

    .line 1
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->inboundPhase()Lio/grpc/internal/AbstractStream$Phase;

    move-result-object v0

    sget-object v1, Lio/grpc/internal/AbstractStream$Phase;->STATUS:Lio/grpc/internal/AbstractStream$Phase;

    if-eq v0, v1, :cond_a

    const/4 v0, 0x1

    goto :goto_b

    :cond_a
    const/4 v0, 0x0

    :goto_b
    return v0
.end method

.method public canSend()Z
    .registers 3

    .line 1
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->outboundPhase()Lio/grpc/internal/AbstractStream$Phase;

    move-result-object v0

    sget-object v1, Lio/grpc/internal/AbstractStream$Phase;->STATUS:Lio/grpc/internal/AbstractStream$Phase;

    if-eq v0, v1, :cond_a

    const/4 v0, 0x1

    goto :goto_b

    :cond_a
    const/4 v0, 0x0

    :goto_b
    return v0
.end method

.method protected final closeDeframer()V
    .registers 2

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->deframer:Lio/grpc/internal/MessageDeframer;

    invoke-virtual {v0}, Lio/grpc/internal/MessageDeframer;->close()V

    return-void
.end method

.method final closeFramer()V
    .registers 2

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    invoke-virtual {v0}, Lio/grpc/internal/MessageFramer;->isClosed()Z

    move-result v0

    if-nez v0, :cond_d

    .line 2
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    invoke-virtual {v0}, Lio/grpc/internal/MessageFramer;->close()V

    :cond_d
    return-void
.end method

.method protected final deframe(Lio/grpc/internal/ReadableBuffer;Z)V
    .registers 4

    .line 1
    :try_start_0
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->deframer:Lio/grpc/internal/MessageDeframer;

    invoke-virtual {v0, p1, p2}, Lio/grpc/internal/MessageDeframer;->deframe(Lio/grpc/internal/ReadableBuffer;Z)V
    :try_end_5
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_5} :catch_6

    goto :goto_a

    :catch_6
    move-exception p1

    .line 2
    invoke-virtual {p0, p1}, Lio/grpc/internal/AbstractStream;->deframeFailed(Ljava/lang/Throwable;)V

    :goto_a
    return-void
.end method

.method protected abstract deframeFailed(Ljava/lang/Throwable;)V
.end method

.method public dispose()V
    .registers 2

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    invoke-virtual {v0}, Lio/grpc/internal/MessageFramer;->dispose()V

    return-void
.end method

.method public final flush()V
    .registers 2

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    invoke-virtual {v0}, Lio/grpc/internal/MessageFramer;->isClosed()Z

    move-result v0

    if-nez v0, :cond_d

    .line 2
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    invoke-virtual {v0}, Lio/grpc/internal/MessageFramer;->flush()V

    :cond_d
    return-void
.end method

.method public getOnReadyThreshold()I
    .registers 3

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->onReadyLock:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_3
    iget v1, p0, Lio/grpc/internal/AbstractStream;->onReadyThreshold:I

    monitor-exit v0

    return v1

    :catchall_7
    move-exception v1

    .line 3
    monitor-exit v0
    :try_end_9
    .catchall {:try_start_3 .. :try_end_9} :catchall_7

    throw v1
.end method

.method public abstract id()Ljava/lang/Object;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "()TIdT;"
        }
    .end annotation
.end method

.method protected abstract inboundDeliveryPaused()V
.end method

.method final inboundPhase()Lio/grpc/internal/AbstractStream$Phase;
    .registers 2

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->inboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    return-object v0
.end method

.method final inboundPhase(Lio/grpc/internal/AbstractStream$Phase;)Lio/grpc/internal/AbstractStream$Phase;
    .registers 3

    .line 2
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->inboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    .line 3
    invoke-virtual {p0, v0, p1}, Lio/grpc/internal/AbstractStream;->verifyNextPhase(Lio/grpc/internal/AbstractStream$Phase;Lio/grpc/internal/AbstractStream$Phase;)Lio/grpc/internal/AbstractStream$Phase;

    move-result-object p1

    iput-object p1, p0, Lio/grpc/internal/AbstractStream;->inboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    return-object v0
.end method

.method protected abstract internalSendFrame(Lio/grpc/internal/WritableBuffer;ZZ)V
.end method

.method public isClosed()Z
    .registers 3

    .line 1
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->inboundPhase()Lio/grpc/internal/AbstractStream$Phase;

    move-result-object v0

    sget-object v1, Lio/grpc/internal/AbstractStream$Phase;->STATUS:Lio/grpc/internal/AbstractStream$Phase;

    if-ne v0, v1, :cond_12

    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->outboundPhase()Lio/grpc/internal/AbstractStream$Phase;

    move-result-object v0

    sget-object v1, Lio/grpc/internal/AbstractStream$Phase;->STATUS:Lio/grpc/internal/AbstractStream$Phase;

    if-ne v0, v1, :cond_12

    const/4 v0, 0x1

    goto :goto_13

    :cond_12
    const/4 v0, 0x0

    :goto_13
    return v0
.end method

.method protected final isDeframerStalled()Z
    .registers 2

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->deframer:Lio/grpc/internal/MessageDeframer;

    invoke-virtual {v0}, Lio/grpc/internal/MessageDeframer;->isStalled()Z

    move-result v0

    return v0
.end method

.method public isReady()Z
    .registers 5

    .line 1
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->listener()Lio/grpc/internal/StreamListener;

    move-result-object v0

    const/4 v1, 0x0

    if-eqz v0, :cond_22

    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->outboundPhase()Lio/grpc/internal/AbstractStream$Phase;

    move-result-object v0

    sget-object v2, Lio/grpc/internal/AbstractStream$Phase;->STATUS:Lio/grpc/internal/AbstractStream$Phase;

    if-eq v0, v2, :cond_22

    .line 2
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->onReadyLock:Ljava/lang/Object;

    monitor-enter v0

    .line 3
    :try_start_12
    iget-boolean v2, p0, Lio/grpc/internal/AbstractStream;->allocated:Z

    if-eqz v2, :cond_1d

    iget v2, p0, Lio/grpc/internal/AbstractStream;->numSentBytesQueued:I

    iget v3, p0, Lio/grpc/internal/AbstractStream;->onReadyThreshold:I

    if-ge v2, v3, :cond_1d

    const/4 v1, 0x1

    :cond_1d
    monitor-exit v0

    return v1

    :catchall_1f
    move-exception v1

    .line 4
    monitor-exit v0
    :try_end_21
    .catchall {:try_start_12 .. :try_end_21} :catchall_1f

    throw v1

    :cond_22
    return v1
.end method

.method protected abstract listener()Lio/grpc/internal/StreamListener;
.end method

.method final notifyIfReady()V
    .registers 3

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->onReadyLock:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_3
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->isReady()Z

    move-result v1

    .line 3
    monitor-exit v0
    :try_end_8
    .catchall {:try_start_3 .. :try_end_8} :catchall_12

    if-eqz v1, :cond_11

    .line 4
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->listener()Lio/grpc/internal/StreamListener;

    move-result-object v0

    invoke-interface {v0}, Lio/grpc/internal/StreamListener;->onReady()V

    :cond_11
    return-void

    :catchall_12
    move-exception v1

    .line 5
    :try_start_13
    monitor-exit v0
    :try_end_14
    .catchall {:try_start_13 .. :try_end_14} :catchall_12

    throw v1
.end method

.method protected final onSendingBytes(I)V
    .registers 4

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->onReadyLock:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_3
    iget v1, p0, Lio/grpc/internal/AbstractStream;->numSentBytesQueued:I

    add-int/2addr v1, p1

    iput v1, p0, Lio/grpc/internal/AbstractStream;->numSentBytesQueued:I

    .line 3
    monitor-exit v0

    return-void

    :catchall_a
    move-exception p1

    monitor-exit v0
    :try_end_c
    .catchall {:try_start_3 .. :try_end_c} :catchall_a

    throw p1
.end method

.method protected final onSentBytes(I)V
    .registers 7

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->onReadyLock:Ljava/lang/Object;

    monitor-enter v0

    .line 2
    :try_start_3
    iget v1, p0, Lio/grpc/internal/AbstractStream;->numSentBytesQueued:I

    iget v2, p0, Lio/grpc/internal/AbstractStream;->onReadyThreshold:I

    const/4 v3, 0x1

    const/4 v4, 0x0

    if-ge v1, v2, :cond_d

    const/4 v1, 0x1

    goto :goto_e

    :cond_d
    const/4 v1, 0x0

    .line 3
    :goto_e
    iget v2, p0, Lio/grpc/internal/AbstractStream;->numSentBytesQueued:I

    sub-int/2addr v2, p1

    iput v2, p0, Lio/grpc/internal/AbstractStream;->numSentBytesQueued:I

    .line 4
    iget p1, p0, Lio/grpc/internal/AbstractStream;->numSentBytesQueued:I

    iget v2, p0, Lio/grpc/internal/AbstractStream;->onReadyThreshold:I

    if-ge p1, v2, :cond_1b

    const/4 p1, 0x1

    goto :goto_1c

    :cond_1b
    const/4 p1, 0x0

    :goto_1c
    if-nez v1, :cond_21

    if-eqz p1, :cond_21

    goto :goto_22

    :cond_21
    const/4 v3, 0x0

    .line 5
    :goto_22
    monitor-exit v0
    :try_end_23
    .catchall {:try_start_3 .. :try_end_23} :catchall_29

    if-eqz v3, :cond_28

    .line 6
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->notifyIfReady()V

    :cond_28
    return-void

    :catchall_29
    move-exception p1

    .line 7
    :try_start_2a
    monitor-exit v0
    :try_end_2b
    .catchall {:try_start_2a .. :try_end_2b} :catchall_29

    throw p1
.end method

.method protected final onStreamAllocated()V
    .registers 5

    .line 1
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->listener()Lio/grpc/internal/StreamListener;

    move-result-object v0

    const/4 v1, 0x0

    const/4 v2, 0x1

    if-eqz v0, :cond_a

    const/4 v0, 0x1

    goto :goto_b

    :cond_a
    const/4 v0, 0x0

    :goto_b
    invoke-static {v0}, Lcom/google/common/base/r;->b(Z)V

    .line 2
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->onReadyLock:Ljava/lang/Object;

    monitor-enter v0

    .line 3
    :try_start_11
    iget-boolean v3, p0, Lio/grpc/internal/AbstractStream;->allocated:Z

    if-nez v3, :cond_16

    const/4 v1, 0x1

    :cond_16
    const-string v3, "Already allocated"

    invoke-static {v1, v3}, Lcom/google/common/base/r;->b(ZLjava/lang/Object;)V

    .line 4
    iput-boolean v2, p0, Lio/grpc/internal/AbstractStream;->allocated:Z

    .line 5
    monitor-exit v0
    :try_end_1e
    .catchall {:try_start_11 .. :try_end_1e} :catchall_22

    .line 6
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->notifyIfReady()V

    return-void

    :catchall_22
    move-exception v1

    .line 7
    :try_start_23
    monitor-exit v0
    :try_end_24
    .catchall {:try_start_23 .. :try_end_24} :catchall_22

    throw v1
.end method

.method final outboundPhase()Lio/grpc/internal/AbstractStream$Phase;
    .registers 2

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->outboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    return-object v0
.end method

.method final outboundPhase(Lio/grpc/internal/AbstractStream$Phase;)Lio/grpc/internal/AbstractStream$Phase;
    .registers 3

    .line 2
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->outboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    .line 3
    invoke-virtual {p0, v0, p1}, Lio/grpc/internal/AbstractStream;->verifyNextPhase(Lio/grpc/internal/AbstractStream$Phase;Lio/grpc/internal/AbstractStream$Phase;)Lio/grpc/internal/AbstractStream$Phase;

    move-result-object p1

    iput-object p1, p0, Lio/grpc/internal/AbstractStream;->outboundPhase:Lio/grpc/internal/AbstractStream$Phase;

    return-object v0
.end method

.method protected abstract receiveMessage(Ljava/io/InputStream;)V
.end method

.method protected abstract remoteEndClosed()V
.end method

.method protected final requestMessagesFromDeframer(I)V
    .registers 3

    .line 1
    :try_start_0
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->deframer:Lio/grpc/internal/MessageDeframer;

    invoke-virtual {v0, p1}, Lio/grpc/internal/MessageDeframer;->request(I)V
    :try_end_5
    .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_5} :catch_6

    goto :goto_a

    :catch_6
    move-exception p1

    .line 2
    invoke-virtual {p0, p1}, Lio/grpc/internal/AbstractStream;->deframeFailed(Ljava/lang/Throwable;)V

    :goto_a
    return-void
.end method

.method protected abstract returnProcessedBytes(I)V
.end method

.method public final setCompressor(Lio/grpc/Compressor;)V
    .registers 4

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    const-string v1, "compressor"

    invoke-static {p1, v1}, Lcom/google/common/base/r;->a(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    check-cast p1, Lio/grpc/Compressor;

    invoke-virtual {v0, p1}, Lio/grpc/internal/MessageFramer;->setCompressor(Lio/grpc/Compressor;)Lio/grpc/internal/MessageFramer;

    return-void
.end method

.method public final setDecompressor(Lio/grpc/Decompressor;)V
    .registers 4

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->deframer:Lio/grpc/internal/MessageDeframer;

    const-string v1, "decompressor"

    invoke-static {p1, v1}, Lcom/google/common/base/r;->a(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    check-cast p1, Lio/grpc/Decompressor;

    invoke-virtual {v0, p1}, Lio/grpc/internal/MessageDeframer;->setDecompressor(Lio/grpc/Decompressor;)V

    return-void
.end method

.method public final setMessageCompression(Z)V
    .registers 3

    .line 1
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    invoke-virtual {v0, p1}, Lio/grpc/internal/MessageFramer;->setMessageCompression(Z)Lio/grpc/internal/MessageFramer;

    return-void
.end method

.method public toString()Ljava/lang/String;
    .registers 2

    .line 1
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->toStringHelper()Lcom/google/common/base/k$a;

    move-result-object v0

    invoke-virtual {v0}, Lcom/google/common/base/k$a;->toString()Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method protected toStringHelper()Lcom/google/common/base/k$a;
    .registers 4

    .line 1
    invoke-static {p0}, Lcom/google/common/base/k;->a(Ljava/lang/Object;)Lcom/google/common/base/k$a;

    move-result-object v0

    .line 2
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->id()Ljava/lang/Object;

    move-result-object v1

    const-string v2, "id"

    invoke-virtual {v0, v2, v1}, Lcom/google/common/base/k$a;->a(Ljava/lang/String;Ljava/lang/Object;)Lcom/google/common/base/k$a;

    .line 3
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->inboundPhase()Lio/grpc/internal/AbstractStream$Phase;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Enum;->name()Ljava/lang/String;

    move-result-object v1

    const-string v2, "inboundPhase"

    invoke-virtual {v0, v2, v1}, Lcom/google/common/base/k$a;->a(Ljava/lang/String;Ljava/lang/Object;)Lcom/google/common/base/k$a;

    .line 4
    invoke-virtual {p0}, Lio/grpc/internal/AbstractStream;->outboundPhase()Lio/grpc/internal/AbstractStream$Phase;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/Enum;->name()Ljava/lang/String;

    move-result-object v1

    const-string v2, "outboundPhase"

    invoke-virtual {v0, v2, v1}, Lcom/google/common/base/k$a;->a(Ljava/lang/String;Ljava/lang/Object;)Lcom/google/common/base/k$a;

    return-object v0
.end method

.method verifyNextPhase(Lio/grpc/internal/AbstractStream$Phase;Lio/grpc/internal/AbstractStream$Phase;)Lio/grpc/internal/AbstractStream$Phase;
    .registers 6

    .line 1
    invoke-virtual {p2}, Ljava/lang/Enum;->ordinal()I

    move-result v0

    invoke-virtual {p1}, Ljava/lang/Enum;->ordinal()I

    move-result v1

    if-lt v0, v1, :cond_b

    return-object p2

    .line 2
    :cond_b
    new-instance v0, Ljava/lang/IllegalStateException;

    const/4 v1, 0x2

    new-array v1, v1, [Ljava/lang/Object;

    const/4 v2, 0x0

    aput-object p1, v1, v2

    const/4 p1, 0x1

    aput-object p2, v1, p1

    const-string p1, "Cannot transition phase from %s to %s"

    .line 3
    invoke-static {p1, v1}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object p1

    invoke-direct {v0, p1}, Ljava/lang/IllegalStateException;-><init>(Ljava/lang/String;)V

    throw v0
.end method

.method public writeMessage(Ljava/io/InputStream;)V
    .registers 3

    .line 1
    invoke-static {p1}, Lcom/google/common/base/r;->a(Ljava/lang/Object;)Ljava/lang/Object;

    .line 2
    sget-object v0, Lio/grpc/internal/AbstractStream$Phase;->MESSAGE:Lio/grpc/internal/AbstractStream$Phase;

    invoke-virtual {p0, v0}, Lio/grpc/internal/AbstractStream;->outboundPhase(Lio/grpc/internal/AbstractStream$Phase;)Lio/grpc/internal/AbstractStream$Phase;

    .line 3
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    invoke-virtual {v0}, Lio/grpc/internal/MessageFramer;->isClosed()Z

    move-result v0

    if-nez v0, :cond_15

    .line 4
    iget-object v0, p0, Lio/grpc/internal/AbstractStream;->framer:Lio/grpc/internal/MessageFramer;

    invoke-virtual {v0, p1}, Lio/grpc/internal/MessageFramer;->writePayload(Ljava/io/InputStream;)V

    :cond_15
    return-void
.end method