Slide 1

Slide 1 text

okio shaunkawano

Slide 2

Slide 2 text

okio • History of okio • Basics of okio • etc
 
 No sample code or project; all I know from research of okio.

Slide 3

Slide 3 text

History of okio

Slide 4

Slide 4 text

History of okio at glance 1. Square team made “OkHttp”; HTTP + SPDY supported client for Android. 2. Processing HTTP using java.io and java.nio inside OkHttp was painful. 3. Square team implemented efficient way of processing data for OkHttp, and exported it as another library, called “okio”.

Slide 5

Slide 5 text

History of okio at glance 1. Square team made “OkHttp”; HTTP + SPDY supported client for Android. 2. Processing HTTP using java.io and java.nio inside OkHttp was painful. 3. Square team implemented efficient way of processing data for OkHttp, and exported it as another library, called “okio”.

Slide 6

Slide 6 text

java.io and java.nio • InputStream is fundamentally for reading data • Decorators • DataInputStream for primitive values • BufferedInputStream / BufferedReader for buffering • InputStreamReader for strings • When processing, fixed-sized Byte[] is passed and created • Hard to program efficiently..! so okie was made. https://www.youtube.com/watch?v=WvyScM_S88c

Slide 7

Slide 7 text

Now okio is used in many Square libraries:
 • OkHttp • Retrofit • Moshi • Wire
 
 and maybe more?

Slide 8

Slide 8 text

Basics of okio

Slide 9

Slide 9 text

Basics of okio • 2014-04-08 Initial Public Release (0.5.0) • Latest Version: 1.9.0 • Imported from OkHttp • “Making it much easier to access, store, and process your data.” • Complement of java.io and java.nio https://github.com/square/okio

Slide 10

Slide 10 text

Basics of okio • Naming Convention: java.io, java.nio => okio. • ByteString and Buffer
 ByteString: Binary data as a value
 Buffer: Mutable sequence of bytes • Source and Sink
 Source: InputStream
 Sink: OutputStream https://github.com/square/okio

Slide 11

Slide 11 text

ByteString ByteString byteString = ByteString.of(bytes); String data = byteString.utf8();
 byteString.base64();
 byteString.hex();
 byteString.md5();
 byteString.sha1();
 byteString.sha256();

Slide 12

Slide 12 text

Extra

Slide 13

Slide 13 text

Extra • What does “Ok” stand for? • blackhole https://github.com/square/okio

Slide 14

Slide 14 text

What does “Ok” stand for? http://fragmentedpodcast.com/episodes/46/

Slide 15

Slide 15 text

What does “Ok” stand for? OkHttp okio http://fragmentedpodcast.com/episodes/46/

Slide 16

Slide 16 text

“Ok” implies Response 200 OK http://fragmentedpodcast.com/episodes/46/

Slide 17

Slide 17 text

Response 200 OK http://fragmentedpodcast.com/episodes/46/ D/OkHttp: <-- 200 OK “Ok” implies

Slide 18

Slide 18 text

blackhole

Slide 19

Slide 19 text

https://github.com/square/okio/issues/229 blackhole

Slide 20

Slide 20 text

blackhole • Added 2 weeks ago; Available from next ver. https://github.com/square/okio/issues/229

Slide 21

Slide 21 text

Maybe okio is helpful for you!
 Maybe replacing java.io, java.nio classes from your code?

Slide 22

Slide 22 text

okio shaunkawano fin.