.class public abstract Lcom/google/common/io/CharSink; .super Ljava/lang/Object; .source "CharSink.java" # interfaces .implements Lcom/google/common/io/OutputSupplier; # annotations .annotation system Ldalvik/annotation/Signature; value = { "Ljava/lang/Object;", "Lcom/google/common/io/OutputSupplier", "<", "Ljava/io/Writer;", ">;" } .end annotation # direct methods .method protected constructor ()V .locals 0 .prologue .line 54 invoke-direct {p0}, Ljava/lang/Object;->()V return-void .end method # virtual methods .method public final getOutput()Ljava/io/Writer; .locals 1 .annotation runtime Ljava/lang/Deprecated; .end annotation .prologue .line 78 invoke-virtual {p0}, Lcom/google/common/io/CharSink;->openStream()Ljava/io/Writer; move-result-object v0 return-object v0 .end method .method public bridge synthetic getOutput()Ljava/lang/Object; .locals 1 .prologue .line 49 invoke-virtual {p0}, Lcom/google/common/io/CharSink;->getOutput()Ljava/io/Writer; move-result-object v0 return-object v0 .end method .method public openBufferedStream()Ljava/io/Writer; .locals 2 .prologue .line 94 invoke-virtual {p0}, Lcom/google/common/io/CharSink;->openStream()Ljava/io/Writer; move-result-object v0 .line 95 instance-of v1, v0, Ljava/io/BufferedWriter; if-eqz v1, :cond_0 check-cast v0, Ljava/io/BufferedWriter; :goto_0 return-object v0 :cond_0 new-instance v1, Ljava/io/BufferedWriter; invoke-direct {v1, v0}, Ljava/io/BufferedWriter;->(Ljava/io/Writer;)V move-object v0, v1 goto :goto_0 .end method .method public abstract openStream()Ljava/io/Writer; .end method .method public write(Ljava/lang/CharSequence;)V .locals 2 .prologue .line 106 invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; .line 108 invoke-static {}, Lcom/google/common/io/Closer;->create()Lcom/google/common/io/Closer; move-result-object v1 .line 110 :try_start_0 invoke-virtual {p0}, Lcom/google/common/io/CharSink;->openStream()Ljava/io/Writer; move-result-object v0 invoke-virtual {v1, v0}, Lcom/google/common/io/Closer;->register(Ljava/io/Closeable;)Ljava/io/Closeable; move-result-object v0 check-cast v0, Ljava/io/Writer; .line 111 invoke-virtual {v0, p1}, Ljava/io/Writer;->append(Ljava/lang/CharSequence;)Ljava/io/Writer; .line 112 invoke-virtual {v0}, Ljava/io/Writer;->flush()V :try_end_0 .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 116 invoke-virtual {v1}, Lcom/google/common/io/Closer;->close()V .line 118 return-void .line 113 :catch_0 move-exception v0 .line 114 :try_start_1 invoke-virtual {v1, v0}, Lcom/google/common/io/Closer;->rethrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException; move-result-object v0 throw v0 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 116 :catchall_0 move-exception v0 invoke-virtual {v1}, Lcom/google/common/io/Closer;->close()V throw v0 .end method .method public writeFrom(Ljava/lang/Readable;)J .locals 4 .prologue .line 164 invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; .line 166 invoke-static {}, Lcom/google/common/io/Closer;->create()Lcom/google/common/io/Closer; move-result-object v1 .line 168 :try_start_0 invoke-virtual {p0}, Lcom/google/common/io/CharSink;->openStream()Ljava/io/Writer; move-result-object v0 invoke-virtual {v1, v0}, Lcom/google/common/io/Closer;->register(Ljava/io/Closeable;)Ljava/io/Closeable; move-result-object v0 check-cast v0, Ljava/io/Writer; .line 169 invoke-static {p1, v0}, Lcom/google/common/io/CharStreams;->copy(Ljava/lang/Readable;Ljava/lang/Appendable;)J move-result-wide v2 .line 170 invoke-virtual {v0}, Ljava/io/Writer;->flush()V :try_end_0 .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 .line 175 invoke-virtual {v1}, Lcom/google/common/io/Closer;->close()V return-wide v2 .line 172 :catch_0 move-exception v0 .line 173 :try_start_1 invoke-virtual {v1, v0}, Lcom/google/common/io/Closer;->rethrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException; move-result-object v0 throw v0 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 175 :catchall_0 move-exception v0 invoke-virtual {v1}, Lcom/google/common/io/Closer;->close()V throw v0 .end method .method public writeLines(Ljava/lang/Iterable;)V .locals 1 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/lang/Iterable", "<+", "Ljava/lang/CharSequence;", ">;)V" } .end annotation .prologue .line 128 const-string v0, "line.separator" invoke-static {v0}, Ljava/lang/System;->getProperty(Ljava/lang/String;)Ljava/lang/String; move-result-object v0 invoke-virtual {p0, p1, v0}, Lcom/google/common/io/CharSink;->writeLines(Ljava/lang/Iterable;Ljava/lang/String;)V .line 129 return-void .end method .method public writeLines(Ljava/lang/Iterable;Ljava/lang/String;)V .locals 4 .annotation system Ldalvik/annotation/Signature; value = { "(", "Ljava/lang/Iterable", "<+", "Ljava/lang/CharSequence;", ">;", "Ljava/lang/String;", ")V" } .end annotation .prologue .line 139 invoke-static {p1}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; .line 140 invoke-static {p2}, Lcom/google/common/base/Preconditions;->checkNotNull(Ljava/lang/Object;)Ljava/lang/Object; .line 142 invoke-static {}, Lcom/google/common/io/Closer;->create()Lcom/google/common/io/Closer; move-result-object v2 .line 144 :try_start_0 invoke-virtual {p0}, Lcom/google/common/io/CharSink;->openBufferedStream()Ljava/io/Writer; move-result-object v0 invoke-virtual {v2, v0}, Lcom/google/common/io/Closer;->register(Ljava/io/Closeable;)Ljava/io/Closeable; move-result-object v0 check-cast v0, Ljava/io/Writer; .line 145 invoke-interface {p1}, Ljava/lang/Iterable;->iterator()Ljava/util/Iterator; move-result-object v3 :goto_0 invoke-interface {v3}, Ljava/util/Iterator;->hasNext()Z move-result v1 if-eqz v1, :cond_0 invoke-interface {v3}, Ljava/util/Iterator;->next()Ljava/lang/Object; move-result-object v1 check-cast v1, Ljava/lang/CharSequence; .line 146 invoke-virtual {v0, v1}, Ljava/io/Writer;->append(Ljava/lang/CharSequence;)Ljava/io/Writer; move-result-object v1 invoke-virtual {v1, p2}, Ljava/io/Writer;->append(Ljava/lang/CharSequence;)Ljava/io/Writer; :try_end_0 .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_0} :catch_0 .catchall {:try_start_0 .. :try_end_0} :catchall_0 goto :goto_0 .line 149 :catch_0 move-exception v0 .line 150 :try_start_1 invoke-virtual {v2, v0}, Lcom/google/common/io/Closer;->rethrow(Ljava/lang/Throwable;)Ljava/lang/RuntimeException; move-result-object v0 throw v0 :try_end_1 .catchall {:try_start_1 .. :try_end_1} :catchall_0 .line 152 :catchall_0 move-exception v0 invoke-virtual {v2}, Lcom/google/common/io/Closer;->close()V throw v0 .line 148 :cond_0 :try_start_2 invoke-virtual {v0}, Ljava/io/Writer;->flush()V :try_end_2 .catch Ljava/lang/Throwable; {:try_start_2 .. :try_end_2} :catch_0 .catchall {:try_start_2 .. :try_end_2} :catchall_0 .line 152 invoke-virtual {v2}, Lcom/google/common/io/Closer;->close()V .line 154 return-void .end method