A Few 'Ok' Libraries (Droidcon MTL 2015)

A Few 'Ok' Libraries (Droidcon MTL 2015)

This talk will be an in-depth look at Okio—a tiny library for interacting with bytes—and a few of the libraries written on top of it: OkHttp, Retrofit, and a newcomer named Moshi.

Okio evolved naturally inside of OkHttp before being split out into its own library. It wraps common patterns behind a friendly API for reading, writing, and processing data. We'll start with some fundamentals of the library and how it can enable you to work very close to raw data with ease.

After an introduction to Okio, we will look at three libraries written with it: OkHttp, a modern HTTP client; Retrofit, a high-level HTTP wrapper; and Moshi, a brand new library for serialization.

Not only are these libraries powerful on their own, but when combined their efficiency and performance dramatically increase. We'll conclude with demonstration of how to use them in your applications to great effect.

Video: https://youtu.be/WvyScM_S88c

E68309f117985270285ade8082f4877d?s=128

Jake Wharton

April 09, 2015
Tweet

Transcript

  1. A Few “OK” Libraries Jake Wharton

  2. okio

  3. okio

  4. okio

  5. okio okhttp moshi retrofit

  6. okio?

  7. HTTP

  8. HTTP GET  /a-­‐few-­‐ok-­‐libraries.html  HTTP/1.1   Host:  droidcon.ca

  9. HTTP GET  /a-­‐few-­‐ok-­‐libraries.html  HTTP/1.1   Host:  droidcon.ca HTTP/1.1  200  OK

      Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000   ! ...
  10. HTTP HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000   ! ...
  11. HTTP HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000   ! ...                ·∙      ·∙    \r\n            ·∙        ·∙  ·∙      ·∙        ·∙                ·∙      \r\n                ·∙                                  ·∙              \r\n                            ·∙                                                  ·∙                          \r\n                                ·∙        \r\n   \r\n
  12. HTTP HTTP/1.1·∙200·∙OK\r\n   Date:·∙Thu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMT\r\n   Server:·∙JakeWharton/2.3.7·∙(Human)\r\n   Content-­‐Type:·∙application/presentation;·∙charset=UTF-­‐8\r\n   Content-­‐Length:·∙3000\r\n

      \r\n   ...
  13. HTTP HTTP/1.1·∙200·∙OK\r\nDate:·∙T   hu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMT\r\nServer:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r

      \n\r\n...
  14. HTTP HTTP/1.1·∙200·∙OK\r\nDate:·∙T   hu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMT\r\nServer:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r

      \n\r\n...
  15. HTTP HTTP/1.1·∙200·∙OK\r\nDate:·∙T   hu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMT\r\nServer:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r

      \n\r\n...
  16. HTTP                  

                       Date:·∙T   hu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMT\r\nServer:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... HTTP/1.1      200      OK
  17. HTTP                  

                       Date:·∙T   hu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMT\r\nServer:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... HTTP/1.1      200      OK
  18. HTTP                  

                       Date:·∙T   hu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMT\r\nServer:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... HTTP/1.1      200      OK
  19. HTTP !                

                                                 Server:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... HTTP/1.1      200      OK Date      Thu,  9  Apr  2015  15:14:34  GMT
  20. java.io.*

  21. java.io.* abstract class InputStream {
 }X

  22. java.io.* abstract class InputStream {
 void close();
 }X

  23. java.io.* abstract class InputStream {
 void close();
 long skip(long byteCount);


    }X
  24. java.io.* abstract class InputStream {
 void close();
 long skip(long byteCount);


    }X
  25. java.io.* abstract class InputStream {
 void close();
 long skip(long byteCount);


    }X 
 while (byteCount > 0) {
 byteCount -= is.skip(byteCount);
 }X

  26. java.io.* abstract class InputStream {
 void close();
 long skip(long byteCount);


    }X public static void reallySkip(InputStream is, long byteCount) {
 while (byteCount > 0) {
 byteCount -= is.skip(byteCount);
 }X
 }
  27. java.io.* abstract class InputStream {
 void close();
 int read(byte[] buffer);


    int read(byte[] buffer, int offset, int count);
 long skip(long byteCount);
 }X
  28. java.io.* abstract class InputStream {
 void close(); int read();
 int

    read(byte[] buffer);
 int read(byte[] buffer, int offset, int count);
 long skip(long byteCount);
 }X
  29. java.io.* abstract class InputStream {
 int available();
 void close();
 void

    mark(int readLimit);
 boolean markSupported(); int read();
 int read(byte[] buffer);
 int read(byte[] buffer, int offset, int count);
 synchronized void reset();
 long skip(long byteCount);
 }X
  30. java.io.* • API is conflated with multiple concepts and inconsistent

    behavior
  31. HTTP !                

                                                 Server:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... HTTP/1.1      200      OK Date      Thu,  9  Apr  2015  15:14:34  GMT
  32. HTTP !                

                                                 Server:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... HTTP/1.1·∙200·∙OKrnDate:·∙Thu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMTrn
  33. HTTP !                

                                                 Server:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... HTTP/1.1·∙200·∙OKrnDate:·∙Thu,·∙9·∙Apr·∙2015·∙15:14:34·∙GMTrn
  34. HTTP !                

                                                 Server:·∙JakeWharto   n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...
  35. HTTP ! ! n/2.3.7·∙(Huma   n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...

    Server:·∙JakeWharto
  36. HTTP ! ! ! n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Huma

  37. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙app
  38. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙app
  39. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...                                                                      Content-­‐Type:·∙app Server      JakeWharton/2.3.7  (Human)
  40. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...                                                                      Content-­‐Type:·∙app
  41. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...                                                                      Content-­‐Type:·∙app                                                                      Content-­‐Type:·∙app
  42. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...                                                                      Content-­‐Type:·∙app Content-­‐Type:·∙app
  43. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Content-­‐Type:·∙app
  44. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Content-­‐Type:·∙app
  45. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...
  46. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...                                                                      Content-­‐Type:·∙app
  47. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...                                                                      Content-­‐Type:·∙app
  48. HTTP ! ! !            

                                     lication/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n...                                                                      Content-­‐Type:·∙app
  49. HTTP ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... lication/presentation;·∙charset  

           Content-­‐Type:·∙app
  50. HTTP ! ! ! !          8\r\nContent-­‐Length:·∙3000\r

      \n\r\n... lication/presentation;·∙charset=UTF-­‐Content-­‐Type:·∙app
  51. java.io.* • API is conflated with multiple concepts and inconsistent

    behavior
  52. java.io.* • API is conflated with multiple concepts and inconsistent

    behavior ! • Burden of figuring out storage is on the consumer
  53. java.io.* class BufferedInputStream extends InputStream {
 BufferedInputStream(InputStream is) {
 //

    ...
 }
 
 BufferedInputStream(InputStream is, int size) {
 // ...
 }
 }
  54. java.io.* ! ! ! n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Huma

  55. java.io.* ! ! ! n)\r\nContent-­‐Type:·∙application/presentation;·∙charset   =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Huma

    Server:·∙JakeWharton/2.3.7·∙(Huma
  56. java.io.* ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙application/presentation;·∙charset Server:·∙JakeWharton/2.3.7·∙(Huma

  57. java.io.* ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙application/presentation;·∙charset Server:·∙JakeWharton/2.3.7·∙(Huma

                                                                 n)rnContent-­‐Type:·∙app
  58. java.io.* ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙application/presentation;·∙charset Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙app

  59. java.io.* ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙application/presentation;·∙charset Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙app

  60. java.io.* ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙application/presentation;·∙charset  

                                                                       Content-­‐Type:·∙app
  61. java.io.* ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙application/presentation;·∙charset  

                                                                       Content-­‐Type:·∙app                                                                                                        lication/presentation;·∙charset
  62. java.io.* ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙application/presentation;·∙charset lication/presentation;·∙charset

             Content-­‐Type:·∙app
  63. java.io.* ! ! ! ! =UTF-­‐8\r\nContent-­‐Length:·∙3000\r   \n\r\n... Server:·∙JakeWharton/2.3.7·∙(Human)rnContent-­‐Type:·∙application/presentation;·∙charset lication/presentation;·∙charset

             Content-­‐Type:·∙app
  64. java.io.* • API is conflated with multiple concepts and inconsistent

    behavior • Burden of figuring out storage is on the consumer
  65. java.io.* • API is conflated with multiple concepts and inconsistent

    behavior • Burden of figuring out storage is on the consumer ! ! • Decorators add performance, functionality
  66. java.io.* class DataInputStream extends InputStream {
 DataInputStream(InputStream in) {}
 


    void readFully(byte[] b) {}
 void readFully(byte b[], int off, int len) {}
 boolean readBoolean() {}
 byte readByte() {}
 int readUnsignedByte() {}
 short readShort() {}
 int readUnsignedShort() {}
 char readChar() {}
 int readInt() {}
 long readLong() {}
 float readFloat() {}
 double readDouble() {}
 String readLine() {}
 String readUTF() {}
 }
  67. java.io.* class DataInputStream extends InputStream {
 DataInputStream(InputStream in) {}
 


    void readFully(byte[] b) {}
 void readFully(byte b[], int off, int len) {}
 boolean readBoolean() {}
 byte readByte() {}
 int readUnsignedByte() {}
 short readShort() {}
 int readUnsignedShort() {}
 char readChar() {}
 int readInt() {}
 long readLong() {}
 float readFloat() {}
 double readDouble() {}
 String readLine() {}
 String readUTF() {}
 } class InputStreamReader extends Reader {
 InputStreamReader(InputStream is) {}
 InputStreamReader(InputStream is, String charsetName) {}
 InputStreamReader(InputStream is, CharsetDecoder dec) {}
 InputStreamReader(InputStream is, Charset charset) {}
 
 int read() {}
 int read(char[] buffer) {}
 int read(char[] buffer, int offset, int count) {}
 int read(CharBuffer buffer) {}
 }
  68. java.io.* • API is conflated with multiple concepts and inconsistent

    behavior • Burden of figuring out storage is on the consumer • Decorators add performance, functionality
  69. java.io.* • API is conflated with multiple concepts and inconsistent

    behavior • Burden of figuring out storage is on the consumer • Decorators add performance, functionality ! ! ! • High-level abstractions exist, but do not compose
  70. Okio

  71. Okio • Complements java.io.* and java.nio.*

  72. Okio • Complements java.io.* and java.nio.* • Source and Sink

    move data
  73. Okio interface Source { }X

  74. Okio interface Source {
 void close(); }X

  75. Okio interface Source {
 Timeout timeout();
 void close(); }X

  76. Okio interface Source {
 long read(Buffer sink, long byteCount);
 Timeout

    timeout();
 void close(); }X
  77. Okio interface Source {
 long read(Buffer sink, long byteCount);
 Timeout

    timeout();
 void close(); }X
  78. Okio interface Sink { }X

  79. Okio interface Sink {
 void write(Buffer sink, long byteCount);
 Timeout

    timeout();
 void close(); }X
  80. Okio interface Sink {
 void write(Buffer sink, long byteCount);
 Timeout

    timeout();
 void close(); void flush(); }X
  81. Okio interface Sink {
 void write(Buffer sink, long byteCount);
 Timeout

    timeout();
 void close(); void flush(); }X
  82. Okio • Complements java.io.* and java.nio.*   • Source and

    Sink move data
  83. Okio • Complements java.io.* and java.nio.*   • Source and

    Sink move data • Complements java.io.* and java.nio  * • Source and Sink move data • Buffer and ByteString hold data
  84. Okio Buffer buffer = new Buffer();

  85. Okio Buffer buffer = new Buffer(); Buffer

  86. Okio Buffer buffer = new Buffer(); Segment Pool byte[] !

    pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 Buffer
  87. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); Segment Pool

    byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 Buffer
  88. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); byte[]

    ! pos=0 limit=0 Segment Pool byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0
  89. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); byte[]

    ! pos=0 limit=15 Segment Pool byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0
  90. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello,

    Droidcon"); byte[] ! pos=0 limit=15 Segment Pool byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0
  91. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello,

    Droidcon"); byte[] ! pos=0 limit=30 Segment Pool byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0
  92. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello,

    Droidcon"); buffer.writeUtf8("Hello, Droidcon"); byte[] ! pos=0 limit=30 Segment Pool byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0
  93. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello,

    Droidcon"); buffer.writeUtf8("Hello, Droidcon"); byte[] ! pos=0 limit=30 byte[] ! pos=0 limit=0 Segment Pool byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0
  94. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello,

    Droidcon"); buffer.writeUtf8("Hello, Droidcon"); byte[] ! pos=0 limit=30 Segment Pool byte[] ! pos=0 limit=15 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0
  95. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello,

    Droidcon"); buffer.writeUtf8("Hello, Droidcon"); byte[] ! pos=0 limit=30 Segment Pool byte[] ! pos=0 limit=15 byte[] ! pos=0 limit=0 byte[] ! pos=0 limit=0
  96. Buffer Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello,

    Droidcon"); buffer.writeUtf8("Hello, Droidcon"); byte[] ! pos=0 limit=30 byte[] ! pos=0 limit=15 Segment Pool
  97. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); Buffer byte[] ! pos=0 limit=30 byte[] ! pos=0 limit=15 Segment Pool
  98. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); // "Hello" Buffer byte[] ! pos=5 limit=30 byte[] ! pos=0 limit=15 Segment Pool
  99. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); // "Hello" buffer.readUtf8(25); Buffer byte[] ! pos=5 limit=30 byte[] ! pos=0 limit=15 Segment Pool
  100. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); // "Hello" buffer.readUtf8(25); // ", DroidconHello, Droidcon" Buffer byte[] ! pos=30 limit=30 byte[] ! pos=0 limit=15 Segment Pool
  101. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); // "Hello" buffer.readUtf8(25); // ", DroidconHello, Droidcon" Buffer byte[] ! pos=0 limit=15 Segment Pool
  102. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); // "Hello" buffer.readUtf8(25); // ", DroidconHello, Droidcon" ! Buffer otherBuffer = new Buffer(); Buffer byte[] ! pos=0 limit=15
  103. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); // "Hello" buffer.readUtf8(25); // ", DroidconHello, Droidcon" ! Buffer otherBuffer = new Buffer(); Buffer byte[] ! pos=0 limit=15 Buffer
  104. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); // "Hello" buffer.readUtf8(25); // ", DroidconHello, Droidcon" ! Buffer otherBuffer = new Buffer(); otherBuffer.writeAll(buffer); Buffer byte[] ! pos=0 limit=15 Buffer
  105. Okio Buffer buffer = new Buffer(); buffer.writeUtf8("Hello, Droidcon"); buffer.writeUtf8("Hello, Droidcon");

    buffer.writeUtf8("Hello, Droidcon”); ! buffer.readUtf8(5); // "Hello" buffer.readUtf8(25); // ", DroidconHello, Droidcon" ! Buffer otherBuffer = new Buffer(); otherBuffer.writeAll(buffer); Buffer byte[] ! pos=0 limit=15 Buffer
  106. Okio • Complements java.io.* and java.nio.*   • Source and

    Sink move data • Buffer and ByteString hold data
  107. Okio • Complements java.io.* and java.nio.*   • Source and

    Sink move data • Buffer and ByteString hold data • Complements java.io.* and java.nio.* • Source and Sink move data • Buffer and ByteString hold data • BufferedSource and BufferedSink move data efficiently
  108. Okio interface BufferedSink extends Sink {
 }X

  109. Okio interface BufferedSource extends Source {
 }X interface BufferedSink extends

    Sink {
 }X
  110. Okio interface BufferedSink extends Sink {
 BufferedSink write(ByteString byteString);
 BufferedSink

    write(byte[] source);
 BufferedSink write(byte[] source, int offset, int byteCount);
 long writeAll(Source source);
 BufferedSink write(Source source, long byteCount);
 BufferedSink writeUtf8(String string);
 BufferedSink writeString(String string, Charset charset);
 BufferedSink writeByte(int b);
 BufferedSink writeShort(int s);
 BufferedSink writeShortLe(int s);
 BufferedSink writeInt(int i);
 BufferedSink writeIntLe(int i);
 BufferedSink writeLong(long v);
 BufferedSink writeLongLe(long v);
 BufferedSink writeDecimalLong(long v);
 BufferedSink writeHexadecimalUnsignedLong(long v);
 }X interface BufferedSource extends Source {
 }X
  111. Okio interface BufferedSource extends Source {
 byte readByte();
 short readShort();


    short readShortLe();
 int readInt();
 int readIntLe();
 long readLong();
 long readLongLe();
 long readDecimalLong();
 long readHexadecimalUnsignedLong();
 ByteString readByteString();
 ByteString readByteString(long byteCount);
 byte[] readByteArray();
 byte[] readByteArray(long byteCount);
 int read(byte[] sink);
 void readFully(byte[] sink);
 int read(byte[] sink, int offset, int byteCount);
 void readFully(Buffer sink, long byteCount);
 long readAll(Sink sink);
 String readUtf8();
 String readUtf8(long byteCount);
 String readUtf8Line();
 String readUtf8LineStrict();
 String readString(Charset charset);
 String readString(long byteCount, Charset charset); 
 long indexOf(byte b);
 long indexOf(byte b, long fromIndex);
 long indexOfElement(ByteString targetBytes);
 long indexOfElement(ByteString targetBytes, long fromIndex);
 }X interface BufferedSink extends Sink {
 BufferedSink write(ByteString byteString);
 BufferedSink write(byte[] source);
 BufferedSink write(byte[] source, int offset, int byteCount);
 long writeAll(Source source);
 BufferedSink write(Source source, long byteCount);
 BufferedSink writeUtf8(String string);
 BufferedSink writeString(String string, Charset charset);
 BufferedSink writeByte(int b);
 BufferedSink writeShort(int s);
 BufferedSink writeShortLe(int s);
 BufferedSink writeInt(int i);
 BufferedSink writeIntLe(int i);
 BufferedSink writeLong(long v);
 BufferedSink writeLongLe(long v);
 BufferedSink writeDecimalLong(long v);
 BufferedSink writeHexadecimalUnsignedLong(long v);
 }X
  112. Okio interface BufferedSource extends Source {
 byte readByte();
 short readShort();


    short readShortLe();
 int readInt();
 int readIntLe();
 long readLong();
 long readLongLe();
 long readDecimalLong();
 long readHexadecimalUnsignedLong();
 ByteString readByteString();
 ByteString readByteString(long byteCount);
 byte[] readByteArray();
 byte[] readByteArray(long byteCount);
 int read(byte[] sink);
 void readFully(byte[] sink);
 int read(byte[] sink, int offset, int byteCount);
 void readFully(Buffer sink, long byteCount);
 long readAll(Sink sink);
 String readUtf8();
 String readUtf8(long byteCount);
 String readUtf8Line();
 String readUtf8LineStrict();
 String readString(Charset charset);
 String readString(long byteCount, Charset charset); 
 long indexOf(byte b);
 long indexOf(byte b, long fromIndex);
 long indexOfElement(ByteString targetBytes);
 long indexOfElement(ByteString targetBytes, long fromIndex); ! boolean exhausted();
 void require(long byteCount);
 boolean request(long byteCount);
 void skip(long byteCount); ! Buffer buffer();
 InputStream inputStream();
 }X interface BufferedSink extends Sink {
 BufferedSink write(ByteString byteString);
 BufferedSink write(byte[] source);
 BufferedSink write(byte[] source, int offset, int byteCount);
 long writeAll(Source source);
 BufferedSink write(Source source, long byteCount);
 BufferedSink writeUtf8(String string);
 BufferedSink writeString(String string, Charset charset);
 BufferedSink writeByte(int b);
 BufferedSink writeShort(int s);
 BufferedSink writeShortLe(int s);
 BufferedSink writeInt(int i);
 BufferedSink writeIntLe(int i);
 BufferedSink writeLong(long v);
 BufferedSink writeLongLe(long v);
 BufferedSink writeDecimalLong(long v);
 BufferedSink writeHexadecimalUnsignedLong(long v);
 BufferedSink emitCompleteSegments(); BufferedSink emit(); ! Buffer buffer();
 OutputStream outputStream();
 }X
  113. Okio classxBuffer implements BufferedSink, BufferedSource { }

  114. Okio Socket

  115. Okio ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• Socket
  116. Okio ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket
  117. Okio BufferedSource Socket ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• source.readInt();
  118. Okio BufferedSource Socket ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• source.readInt();
  119. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt();
  120. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket        •••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
  121. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket        •••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt();
  122. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket                •••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
  123. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket                •••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4);
  124. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket                        •••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
  125. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket                        •••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong();
  126. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket                                    ••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
  127. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict();          ••••••••••
  128. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket ! ! ! •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
  129. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket ! ! ! •••••••••••••••   •••••••••••••••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict();
  130. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket ! ! ! !                          ••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); ••••••••••••••••••••••••••••
  131. Okio ! ! ! ! ! ! ••••••••••••••• ••••••••••••••• •••••••••••••••

    ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• ••••••••••••••• BufferedSource Socket ! ! ! !                          ••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40);
  132. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket ! ! ! !                          ••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40);
  133. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket ! ! ! !                          ••   ••••••••••••••• source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••
  134. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• !              ••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••
  135. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• !              ••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••
  136. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); !              ••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••
  137. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• ! ! ! ! •••••••••••••••   •••••••••••••••
  138. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); ! ! ! ! •••••••••••••••   •••••••••••••••
  139. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• ! ! ! !        •••••••••••   •••••••••••••••
  140. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); ! ! ! !        •••••••••••   •••••••••••••••
  141. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); •••• ! ! ! !                •••••••   •••••••••••••••
  142. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); •••• source.readLong(); ! ! ! !                •••••••   •••••••••••••••
  143. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); •••• source.readLong(); •••••••• ! ! ! !                                  ••••••••••••••
  144. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); •••• source.readLong(); •••••••• source.readLong(); ! ! ! !                                  ••••••••••••••
  145. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); •••• source.readLong(); •••••••• source.readLong(); •••••••• ! ! ! !                                                  ••••••
  146. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); •••• source.readLong(); •••••••• source.readLong(); •••••••• source.readUtf8(6); ! ! ! !                                                  ••••••
  147. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); •••• source.readLong(); •••••••• source.readLong(); •••••••• source.readUtf8(6); ••••••
  148. Okio ! ! ! ! ! ! ! ! !

    ! ! ! •••••••••••••••   •••••••••••••••   •••••••••••••••   •••••••••••••••   ••••••••••••••• BufferedSource Socket source.readInt(); ••••
 source.readInt(); ••••
 source.readUtf8(4); ••••
 source.readLong(); ••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••
 source.readUtf8LineStrict(); •••••••••••••••••••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readUtf8(40); •••••••••••••••••••••••••••• ••••••••••• source.readInt(); •••• source.readInt(); •••• source.readLong(); •••••••• source.readLong(); •••••••• source.readUtf8(6); ••••••
  149. Okio class Okio {
 static BufferedSource buffer(Source source) {}
 static

    BufferedSink buffer(Sink sink) {}
 }X
  150. Okio class Okio {
 static BufferedSource buffer(Source source) {}
 static

    BufferedSink buffer(Sink sink) {}
 
 static Source source(InputStream in) {}
 static Sink sink(OutputStream out) {}
 }X
  151. Okio class Okio {
 static BufferedSource buffer(Source source) {}
 static

    BufferedSink buffer(Sink sink) {}
 
 static Source source(InputStream in) {}
 static Sink sink(OutputStream out) {}
 
 static Source source(Socket socket) {}
 static Sink sink(Socket socket) {}
 }X
  152. Okio class Okio {
 static BufferedSource buffer(Source source) {}
 static

    BufferedSink buffer(Sink sink) {}
 
 static Source source(InputStream in) {}
 static Sink sink(OutputStream out) {}
 
 static Source source(Socket socket) {}
 static Sink sink(Socket socket) {}
 
 static Source source(File file) {}
 static Sink sink(File file) {}
 static Sink appendingSink(File file) {}
 }X
  153. Okio class Okio {
 static BufferedSource buffer(Source source) {}
 static

    BufferedSink buffer(Sink sink) {}
 
 static Source source(InputStream in) {}
 static Sink sink(OutputStream out) {}
 
 static Source source(Socket socket) {}
 static Sink sink(Socket socket) {}
 
 static Source source(File file) {}
 static Sink sink(File file) {}
 static Sink appendingSink(File file) {}
 
 static Source source(Path path, OpenOption... options) {}
 static Sink sink(Path path, OpenOption... options) {}
 }X
  154. Okio class DeflaterSink {
 DeflaterSink(Sink sink, Deflater deflater) {}
 }

  155. Okio ! ! ! ! class InflaterSource {
 InflaterSource(Source source,

    Inflater inflater) {}
 } class DeflaterSink {
 DeflaterSink(Sink sink, Deflater deflater) {}
 }
  156. Okio ! ! ! ! ! ! ! ! class

    GzipSink {
 GzipSink(Sink sink) {}
 } ! ! ! ! class InflaterSource {
 InflaterSource(Source source, Inflater inflater) {}
 } class DeflaterSink {
 DeflaterSink(Sink sink, Deflater deflater) {}
 }
  157. Okio ! ! ! ! ! ! ! ! class

    GzipSink {
 GzipSink(Sink sink) {}
 } 
 
 
 
 
 
 
 
 
 
 
 
 class GzipSource {
 GzipSource(Source source) {}
 } ! ! ! ! class InflaterSource {
 InflaterSource(Source source, Inflater inflater) {}
 } class DeflaterSink {
 DeflaterSink(Sink sink, Deflater deflater) {}
 }
  158. Okio File file = // ... File

  159. Okio File file = // ...
 Sink fileSink = Okio.sink(file);

    File FileSink
  160. Okio File file = // ...
 Sink fileSink = Okio.sink(file);


    Sink gzipSink = new GzipSink(fileSink); File GzipSink FileSink
  161. Okio File file = // ...
 Sink fileSink = Okio.sink(file);


    Sink gzipSink = new GzipSink(fileSink);
 BufferedSink bufferedSink = Okio.buffer(gzipSink); File BufferedSink GzipSink FileSink
  162. Okio File file = // ...
 Sink fileSink = Okio.sink(file);


    Sink gzipSink = new GzipSink(fileSink);
 BufferedSink bufferedSink = Okio.buffer(gzipSink);
 bufferedSink.writeUtf8("Hello, hello, hello!"); File FileSink GzipSink BufferedSink 
 
 
 
 "Hello, hello, hello!"
  163. Okio File file = // ...
 Sink fileSink = Okio.sink(file);


    Sink gzipSink = new GzipSink(fileSink);
 BufferedSink bufferedSink = Okio.buffer(gzipSink);
 bufferedSink.writeUtf8("Hello, hello, hello!"); File FileSink GzipSink BufferedSink Hello, hello, hello!
  164. x??H????Q?@?H?? Okio File file = // ...
 Sink fileSink =

    Okio.sink(file);
 Sink gzipSink = new GzipSink(fileSink);
 BufferedSink bufferedSink = Okio.buffer(gzipSink);
 bufferedSink.writeUtf8("Hello, hello, hello!"); bufferedSink.close(); File FileSink GzipSink BufferedSink Hello, hello, hello!
  165. Hello, hello, hello! Okio File file = // ...
 Sink

    fileSink = Okio.sink(file);
 Sink gzipSink = new GzipSink(fileSink);
 BufferedSink bufferedSink = Okio.buffer(gzipSink);
 bufferedSink.writeUtf8("Hello, hello, hello!"); bufferedSink.close(); File FileSink GzipSink BufferedSink x??H????Q?@?H??
  166. Okio File file = // ...
 Sink fileSink = Okio.sink(file);


    Sink gzipSink = new GzipSink(fileSink);
 BufferedSink bufferedSink = Okio.buffer(gzipSink);
 bufferedSink.writeUtf8("Hello, hello, hello!"); bufferedSink.close(); File FileSink GzipSink BufferedSink x??H????Q?@?H??
  167. Okio File file = // ...
 Sink fileSink = Okio.sink(file);


    Sink gzipSink = new GzipSink(fileSink);
 BufferedSink bufferedSink = Okio.buffer(gzipSink);
 bufferedSink.writeUtf8("Hello, hello, hello!"); bufferedSink.close(); File FileSink GzipSink BufferedSink x??H????Q?@?H??
  168. Okio File file = // ...
 Sink fileSink = Okio.sink(file);


    Sink gzipSink = new GzipSink(fileSink);
 Sha1Sink hashingSink = new Sha1Sink(gzipSink);
 BufferedSink bufferedSink = Okio.buffer(hashingSink);
 
 bufferedSink.writeUtf8("Hello, hello, hello!");
 bufferedSink.close();
 
 String hash = hashingSink.hash(); File FileSink GzipSink BufferedSink Sha1Sink
  169. Okio Socket socket = //...
 Source socketSource = Okio.source(socket);

  170. Okio Socket socket = //...
 Source socketSource = Okio.source(socket);
 


    Throttler throttler = new Throttler();
 Source throttledSource = throttler.throttle(socketSource);
  171. Okio Socket socket = //...
 Source socketSource = Okio.source(socket);
 


    Throttler throttler = new Throttler();
 Source throttledSource = throttler.throttle(socketSource);
 
 BufferedSource bufferedSource = Okio.buffer(throttledSource);
 bufferedSource.readUtf8(10 * 1024);
  172. Okio Socket socket = //...
 Source socketSource = Okio.source(socket);
 


    Throttler throttler = new Throttler();
 Source throttledSource = throttler.throttle(socketSource);
 
 BufferedSource bufferedSource = Okio.buffer(throttledSource);
 bufferedSource.readUtf8(10 * 1024);
 
 throttler.bytesPerTimePeriod(50, 1, SECONDS);
 bufferedSource.readUtf8(10 * 1024);
  173. OkHttp

  174. OkHttp OkHttpClient client = new OkHttpClient();

  175. OkHttp OkHttpClient client = new OkHttpClient(); 
 
 Request request

    = new Request.Builder()
 .url("http://droidcon.ca/a-few-ok-libraries.html")
 .build();
  176. OkHttp OkHttpClient client = new OkHttpClient(); 
 
 RequestBody requestBody

    = // ... Request request = new Request.Builder()
 .url("http://droidcon.ca/a-few-ok-libraries.html") .post(requestBody)
 .build();
  177. OkHttp OkHttpClient client = new OkHttpClient(); 
 
 RequestBody requestBody

    = // ... Request request = new Request.Builder()
 .url("http://droidcon.ca/a-few-ok-libraries.html") .post(requestBody)
 .build(); class RequestBody {
 static RequestBody create(MediaType mediaType, String body) {}
 static RequestBody create(MediaType mediaType, byte[] body) {}
 static RequestBody create(MediaType mediaType, File body) {}
 }X
  178. OkHttp class RequestBody {
 static RequestBody create(MediaType mediaType, String body)

    {}
 static RequestBody create(MediaType mediaType, byte[] body) {}
 static RequestBody create(MediaType mediaType, File body) {}
 }X
  179. OkHttp abstract class RequestBody {
 static RequestBody create(MediaType mediaType, String

    body) {}
 static RequestBody create(MediaType mediaType, byte[] body) {}
 static RequestBody create(MediaType mediaType, File body) {}
 
 long contentLength();
 MediaType contentType();
 void writeTo(BufferedSink sink);
 }X
  180. OkHttp ! ! ! ! ! ! ! requestBody.writeTo(sink);

  181. OkHttp ! ! ! ! ! ! ! requestBody.writeTo(sink); Socket

  182. OkHttp GET  /a-­‐few-­‐ok-­‐libraries.html  HTTP/1.1   Host:  droidcon.ca   Content-­‐Type:  text/plain

      Content-­‐Length:  3000 ! ! ! ! ! ! ! requestBody.writeTo(sink); Socket
  183. OkHttp GET  /a-­‐few-­‐ok-­‐libraries.html  HTTP/1.1   Host:  droidcon.ca   Content-­‐Type:  text/plain

      Content-­‐Length:  3000 ! ! ! ! ! ! ! requestBody.writeTo(sink); Socket FixedLengthSink
  184. OkHttp GET  /a-­‐few-­‐ok-­‐libraries.html  HTTP/1.1   Host:  droidcon.ca   Content-­‐Type:  text/plain

      Content-­‐Length:  3000 ! ! ! ! ! ! ! requestBody.writeTo(sink); Socket FixedLengthSink ! ! ! ! ! You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing.
  185. OkHttp Socket HTTP/2

  186. OkHttp requestBody1 Socket requestBody2 HTTP/2

  187. OkHttp requestBody1 Socket FramedSink FramedSink requestBody2 HTTP/2

  188. OkHttp requestBody1 Socket FixedLengthSink FramedSink FramedSink FixedLengthSink requestBody2 HTTP/2

  189. OkHttp requestBody1 Socket FixedLengthSink FramedSink FramedSink FixedLengthSink requestBody2 HTTP/2

  190. OkHttp OkHttpClient client = new OkHttpClient(); 
 
 Request request

    = new Request.Builder()
 .url("http://droidcon.ca/a-few-ok-libraries.html")
 .build();
  191. OkHttp OkHttpClient client = new OkHttpClient(); 
 
 Request request

    = new Request.Builder()
 .url("http://droidcon.ca/a-few-ok-libraries.html")
 .build(); 
 
 
 
 
 
 Response response = .execute(); client.newCall(request)
  192. OkHttp OkHttpClient client = new OkHttpClient(); 
 
 Request request

    = new Request.Builder()
 .url("http://droidcon.ca/a-few-ok-libraries.html")
 .build(); 
 
 
 
 
 
 Response response = .execute(); 
 
 
 
 
 
 
 
 System.out.println( ); client.newCall(request) response.body().string()
  193. OkHttp 
 
 
 
 
 
 .enqueue(new Callback() {


    @Override void onResponse(Response response) {
 
 }
 
 @Override void onFailure(Request request, IOException e) {
 // ...
 }
 }); OkHttpClient client = new OkHttpClient(); 
 
 Request request = new Request.Builder()
 .url("http://droidcon.ca/a-few-ok-libraries.html")
 .build(); 
 
 
 
 
 
 
 
 System.out.println( ); client.newCall(request) response.body().string()
  194. OkHttp String string = ; response.body().string()

  195. OkHttp ResponseBody body = response.body();
 String string = body.string();

  196. OkHttp ResponseBody body = response.body();
 String string = body.string(); 


    
 Reader reader = body.charStream();
  197. OkHttp ResponseBody body = response.body(); 
 String string = body.string();


    Reader reader = body.charStream();
 InputStream stream = body.byteStream();
  198. OkHttp ResponseBody body = response.body(); 
 String string = body.string();


    Reader reader = body.charStream();
 InputStream stream = body.byteStream();
 byte[] bytes = body.bytes();
  199. OkHttp ResponseBody body = response.body(); 
 String string = body.string();


    Reader reader = body.charStream();
 InputStream stream = body.byteStream();
 byte[] bytes = body.bytes(); ! BufferedSource source = body.source();
  200. OkHttp ! ! ! ! ! ! ! body.source();

  201. OkHttp HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000   ! You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing. ! ! ! ! ! ! ! body.source(); Socket HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000
  202. OkHttp HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000   ! You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing. ! ! ! ! ! ! ! body.source(); Socket HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000
  203. OkHttp HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000   ! You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing. ! ! ! ! ! ! ! body.source(); Socket HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000
  204. OkHttp HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000   ! You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing. ! ! ! ! ! ! ! body.source(); Socket HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000 FixedLengthSource
  205. OkHttp HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000   ! You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing. ! ! ! ! ! ! ! body.source(); Socket HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Length:  3000 FixedLengthSource
  206. OkHttp HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Encoding:  gzip   Content-­‐Length:  3000   ! You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing. ! ! ! ! ! ! ! body.source(); Socket HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Content-­‐Encoding:  gzip   Content-­‐Length:  3000 GzipSource FixedLengthSource
  207. OkHttp HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Transfer-­‐Encoding:  chunked   ! 1F6   You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! 18C   Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! 158   Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! 1EF   The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! 1E3   My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! 12B   Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! 165   Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing. ! ! ! ! ! ! ! body.source(); Socket HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Transfer-­‐Encoding:  chunked ChunkedSource
  208. OkHttp HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015

     15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Transfer-­‐Encoding:  chunked   ! 1F6   You  think  water  moves  fast?  You  should  see  ice.  It   moves  like  it  has  a  mind.  Like  it  knows  it  killed  the   world  once  and  got  a  taste  for  murder.  After  the   avalanche,  it  took  us  a  week  to  climb  out.  Now,  I  don't   know  exactly  when  we  turned  on  each  other,  but  I  know   that  seven  of  us  survived  the  slide...  and  only  five   made  it  out.  Now  we  took  an  oath,  that  I'm  breaking   now.  We  said  we'd  say  it  was  the  snow  that  killed  the   other  two,  but  it  wasn't.  Nature  is  lethal  but  it   doesn't  hold  a  candle  to  man.   ! 18C   Your  bones  don't  break,  mine  do.  That's  clear.  Your   cells  react  to  bacteria  and  viruses  differently  than   mine.  You  don't  get  sick,  I  do.  That's  also  clear.  But   for  some  reason,  you  and  I  react  the  exact  same  way  to   water.  We  swallow  it  too  fast,  we  choke.  We  get  some  in   our  lungs,  we  drown.  However  unreal  it  may  seem,  we  are   connected,  you  and  I.  We're  on  the  same  curve,  just  on   opposite  ends.   ! 158   Normally,  both  your  asses  would  be  dead  as  fucking   fried  chicken,  but  you  happen  to  pull  this  shit  while   I'm  in  a  transitional  period  so  I  don't  wanna  kill  you,   I  wanna  help  you.  But  I  can't  give  you  this  case,  it   don't  belong  to  me.  Besides,  I've  already  been  through   too  much  shit  this  morning  over  this  case  to  hand  it   over  to  your  dumb  ass.   ! 1EF   The  path  of  the  righteous  man  is  beset  on  all  sides  by   the  iniquities  of  the  selfish  and  the  tyranny  of  evil   men.  Blessed  is  he  who,  in  the  name  of  charity  and  good   will,  shepherds  the  weak  through  the  valley  of   darkness,  for  he  is  truly  his  brother's  keeper  and  the   finder  of  lost  children.  And  I  will  strike  down  upon   thee  with  great  vengeance  and  furious  anger  those  who   would  attempt  to  poison  and  destroy  My  brothers.  And   you  will  know  My  name  is  the  Lord  when  I  lay  My   vengeance  upon  thee.   ! 1E3   My  money's  in  that  office,  right?  If  she  start  giving   me  some  bullshit  about  it  ain't  there,  and  we  got  to  go   someplace  else  and  get  it,  I'm  gonna  shoot  you  in  the   head  then  and  there.  Then  I'm  gonna  shoot  that  bitch  in   the  kneecaps,  find  out  where  my  goddamn  money  is.  She   gonna  tell  me  too.  Hey,  look  at  me  when  I'm  talking  to   you,  motherfucker.  You  listen:  we  go  in  there,  and  that   nigga  Winston  or  anybody  else  is  in  there,  you  the   first  motherfucker  to  get  shot.  You  understand?   ! 12B   Look,  just  because  I  don't  be  givin'  no  man  a  foot   massage  don't  make  it  right  for  Marsellus  to  throw   Antwone  into  a  glass  motherfuckin'  house,  fuckin'  up   the  way  the  nigger  talks.  Motherfucker  do  that  shit  to   me,  he  better  paralyze  my  ass,  'cause  I'll  kill  the   motherfucker,  know  what  I'm  sayin’?   ! 165   Well,  the  way  they  make  shows  is,  they  make  one  show.   That  show's  called  a  pilot.  Then  they  show  that  show  to   the  people  who  make  shows,  and  on  the  strength  of  that   one  show  they  decide  if  they're  going  to  make  more   shows.  Some  pilots  get  picked  and  become  television   programs.  Some  don't,  become  nothing.  She  starred  in   one  of  the  ones  that  became  nothing. ! ! ! ! ! ! ! body.source(); Socket HTTP/1.1  200  OK   Date:  Thu,  9  Apr  2015  15:14:34  GMT   Server:  JakeWharton/2.3.7  (Human)   Content-­‐Type:  application/presentation;  charset=UTF-­‐8   Transfer-­‐Encoding:  chunked ChunkedSource
  209. OkHttp Socket HTTP/2

  210. OkHttp Socket HTTP/2

  211. OkHttp Socket FramedSource FramedSource HTTP/2

  212. OkHttp Socket FixedLengthSource FramedSource FramedSource FixedLengthSource HTTP/2

  213. OkHttp body1.source(); Socket FixedLengthSource FramedSource FramedSource FixedLengthSource body2.source(); HTTP/2

  214. Moshi

  215. Moshi • JsonReader / JsonWriter for streaming

  216. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);

  217. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject(); {
  218. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries"); {      "title":  "A  Few  'Ok'  Libraries"
  219. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries");
 writer.name("presenter")
 .value("Jake Wharton"); {      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton"
  220. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries");
 writer.name("presenter")
 .value("Jake Wharton");
 writer.name("tags")
 .beginArray(); {      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton",      "tags":  [
  221. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries");
 writer.name("presenter")
 .value("Jake Wharton");
 writer.name("tags")
 .beginArray()
 .value("Okio")
 .value("OkHttp")
 .value("Moshi")
 .value("Retrofit"); {      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton",      "tags":  [          "Okio",          "OkHttp",          "Moshi",          "Retrofit
  222. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries");
 writer.name("presenter")
 .value("Jake Wharton");
 writer.name("tags")
 .beginArray()
 .value("Okio")
 .value("OkHttp")
 .value("Moshi")
 .value("Retrofit")
 .endArray(); {      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton",      "tags":  [          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]
  223. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries");
 writer.name("presenter")
 .value("Jake Wharton");
 writer.name("tags")
 .beginArray()
 .value("Okio")
 .value("OkHttp")
 .value("Moshi")
 .value("Retrofit")
 .endArray();
 writer.endObject(); {      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton",      "tags":  [          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]   }
  224. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries");
 writer.name("presenter")
 .value("Jake Wharton");
 writer.name("tags")
 .beginArray()
 .value("Okio")
 .value("OkHttp")
 .value("Moshi")
 .value("Retrofit")
 .endArray();
 writer.endObject(); 
 writer.close(); {  X      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton",      "tags":  [          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]  Y   }  Z
  225. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries");
 writer.name("presenter")
 .value("Jake Wharton");
 writer.name("tags")
 .beginArray()
 .value("Okio")
 .value("OkHttp")
 .value("Moshi")
 .value("Retrofit")
 .endArray();
 writer.endObject(); 
 writer.close(); Sink sink = //...
 BufferedSink s = Okio.buffer(sink); 
 s.writeByte('{');
 s.writeByte('"').writeUtf8("title").writeByte('"');
 s.writeByte(':').writeByte('"')
 .writeUtf8("A Few 'Ok' Libraries")
 .writeByte('"');
 s.writeByte(',');
 s.writeByte('"').writeUtf8("presenter").writeByte('"');
 s.writeByte(':').writeByte('"')
 .writeUtf8("Jake Wharton")
 .writeByte('"');
 s.writeByte(',');
 s.writeByte('"').writeUtf8("tags").writeByte('"');
 s.writeByte(':').writeByte('[');
 s.writeByte('"').writeUtf8("Okio").writeByte('"');
 s.writeByte(','); s.writeByte('"').writeUtf8("OkHttp").writeByte('"');
 s.writeByte(','); s.writeByte('"').writeUtf8("Moshi").writeByte('"');
 s.writeByte(','); s.writeByte('"').writeUtf8("Retrofit").writeByte('"');
 s.writeByte(']');
 s.writeByte('}');
 s.close();
  226. Moshi Sink sink = //...
 JsonWriter writer = new JsonWriter(sink);


    writer.beginObject();
 writer.name("title")
 .value("A Few 'Ok' Libraries");
 writer.name("presenter")
 .value("Jake Wharton");
 writer.name("tags")
 .beginArray()
 .value("Okio")
 .value("OkHttp")
 .value("Moshi")
 .value("Retrofit")
 .endArray();
 writer.endObject(); 
 writer.close(); {X      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton",      "tags":  [X          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]X   }X
  227. Moshi Source source = //...
 JsonReader reader = new JsonReader(source);

    {X      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton",      "tags":  [          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]X   }X
  228. Moshi Source source = //...
 JsonReader reader = new JsonReader(source);


    
 reader.beginObject();
 while (reader.peek() != Token.END_OBJECT) {
 switch (reader.nextName()) {
 case "title":
 String title = reader.nextString();
 // TODO do something with 'title'...
 break;
 case "presenter":
 String presenter = reader.nextString();
 // TODO do something with 'presenter'...
 break;
 case "tags":
 reader.beginArray();
 Set<String> tags = new LinkedHashSet<>();
 while (reader.peek() != Token.END_ARRAY) {
 tags.add(reader.nextString());
 }
 reader.endArray();
 // TODO do something with 'tags'...
 break;
 default: break; // Ignored
 }
 }
 reader.endObject();
 reader.close(); {X      "title":  "A  Few  'Ok'  Libraries",      "presenter":  "Jake  Wharton",      "tags":  [          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]X   }X
  229. Moshi Source source = //...
 JsonReader reader = new JsonReader(source);


    
 reader.beginObject();
 while (reader.peek() != Token.END_OBJECT) {
 switch (reader.nextName()) {
 case "title":
 String title = reader.nextString();
 // TODO do something with 'title'...
 break;
 case "presenter":
 String presenter = reader.nextString();
 // TODO do something with 'presenter'...
 break;
 case "tags":
 reader.beginArray();
 Set<String> tags = new LinkedHashSet<>();
 while (reader.peek() != Token.END_ARRAY) {
 tags.add(reader.nextString());
 }
 reader.endArray();
 // TODO do something with 'tags'...
 break;
 default: break; // Ignored
 }
 }
 reader.endObject();
 reader.close(); static final ByteString DOUBLE_QUOTE = ByteString.encodeUtf8("\"");
 
 long i = s.indexOfElement(DOUBLE_QUOTE);
 String string = s.readUtf8(i);
  230. Moshi • JsonReader / JsonWriter for streaming

  231. Moshi • JsonReader / JsonWriter for streaming • JsonAdapter for

    object mapping
  232. Moshi {X      "title":  "A  Few  'Ok'  Libraries",  

       "presenter":  "Jake  Wharton",      "tags":  [X          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]X   }X
  233. Moshi {X      "title":  "A  Few  'Ok'  Libraries",  

       "presenter":  "Jake  Wharton",      "tags":  [X          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]X   }X class Presentation {
 String title;
 String presenter;
 Set<String> tags;
 }
  234. Moshi {X      "title":  "A  Few  'Ok'  Libraries",  

       "presenter":  "Jake  Wharton",      "tags":  [X          "Okio",          "OkHttp",          "Moshi",          "Retrofit      ]X   }X class Presentation {
 String title;
 String presenter;
 Set<String> tags;
 } JsonAdapter<Presentation> adapter = moshi.adapter(Presentation.class); 
 Presentation presentation = adapter.fromJson(source);
  235. Retrofit

  236. Retrofit interface DroidconMtl {
 @GET("/a-few-ok-libraries.json")
 Presentation okLibraries();
 }

  237. Retrofit interface DroidconMtl {
 @GET("/a-few-ok-libraries.json")
 Presentation okLibraries();
 } class Presentation

    {
 String title;
 String presenter;
 Set<String> tags;
 }
  238. Retrofit interface DroidconMtl {
 @GET("/a-few-ok-libraries.json")
 Presentation okLibraries();
 } RestAdapter ra

    = new RestAdapter.Builder()
 .setEndpoint("http://droidcon.ca")
 .build();
  239. Retrofit interface DroidconMtl {
 @GET("/a-few-ok-libraries.json")
 Presentation okLibraries();
 } RestAdapter ra

    = new RestAdapter.Builder()
 .setEndpoint("http://droidcon.ca")
 .build(); 
 
 
 
 DroidconMtl droidconMtl = ra.create(DroidconMtl.class);
  240. Retrofit interface DroidconMtl {
 @GET("/a-few-ok-libraries.json")
 Presentation okLibraries();
 } RestAdapter ra

    = new RestAdapter.Builder()
 .setEndpoint("http://droidcon.ca")
 .build(); 
 
 
 
 DroidconMtl droidconMtl = ra.create(DroidconMtl.class); 
 
 
 ! 
 Presentation ok = droidconMtl.okLibraries();
  241. Retrofit RestAdapter ra = new RestAdapter.Builder()
 .setEndpoint("http://droidcon.ca")
 .build();

  242. Retrofit RestAdapter ra = new RestAdapter.Builder()
 .setEndpoint("http://droidcon.ca")
 .setClient(new OkHttpClient())
 .build();

  243. Retrofit RestAdapter ra = new RestAdapter.Builder()
 .setEndpoint("http://droidcon.ca")
 .setClient(new OkHttpClient())
 .setConverter(new

    MoshiConverter())
 .build();
  244. Retrofit

  245. Retrofit OkHttp

  246. Retrofit OkHttp Socket

  247. Retrofit OkHttp FixedLengthSource FixedLengthSink Socket

  248. Retrofit OkHttp FixedLengthSource FixedLengthSink RequestBody ResponseBody Socket

  249. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody Socket

  250. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody Socket Moshi

  251. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody Socket Moshi BufferedSink

    BufferedSource <T>
  252. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody <T> RequestBody ResponseBody

    Socket Moshi BufferedSink BufferedSource <T>
  253. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody <T> DroidconMtl RequestBody

    ResponseBody Socket Moshi BufferedSink BufferedSource <T>
  254. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody <T> DroidconMtl RequestBody

    ResponseBody Socket okLibraries() Moshi BufferedSink BufferedSource <T>
  255. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody <T> DroidconMtl RequestBody

    ResponseBody Socket execute() okLibraries() Moshi BufferedSink BufferedSource <T>
  256. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody <T> DroidconMtl RequestBody

    ResponseBody Socket execute() okLibraries() Moshi BufferedSink BufferedSource <T>
  257. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody <T> DroidconMtl RequestBody

    ResponseBody Socket execute() okLibraries() Moshi BufferedSink BufferedSource <T>
  258. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody <T> DroidconMtl RequestBody

    ResponseBody Socket execute() okLibraries() Moshi BufferedSink BufferedSource <T>
  259. Retrofit OkHttp MoshiConverter FixedLengthSource FixedLengthSink RequestBody ResponseBody <T> DroidconMtl RequestBody

    ResponseBody Socket execute() okLibraries() Moshi BufferedSink BufferedSource <T>
  260. okio okhttp moshi retrofit

  261. A Few “OK” Libraries

  262. A Few “OK” Libraries jakewharton jakewharton jakewharton twitter.com/ google.com/+ .com