### Question:
Okio { public static Source source(InputStream in) { return source(in, new Timeout()); } private  Okio(); static BufferedSource buffer(Source source); static BufferedSink buffer(Sink sink); static Sink sink(OutputStream out); static Sink sink(Socket socket); static Source source(InputStream in); static Source source(File file); static Sink sink(File file); static Sink appendingSink(File file); static Source source(Socket socket);  }### Answer:
@Test public void sourceFromInputStream() throws Exception { InputStream in = new ByteArrayInputStream( ("a" + repeat('b', Segment.SIZE * 2) + "c").getBytes(UTF_8)); Source source = Okio.source(in); Buffer sink = new Buffer(); assertEquals(3, source.read(sink, 3)); assertEquals("abb", sink.readUtf8(3)); assertEquals(Segment.SIZE, source.read(sink, 20000)); assertEquals(repeat('b', Segment.SIZE), sink.readUtf8()); assertEquals(Segment.SIZE - 1, source.read(sink, 20000)); assertEquals(repeat('b', Segment.SIZE - 2) + "c", sink.readUtf8()); assertEquals(-1, source.read(sink, 1)); }
@Test public void sourceFromInputStreamBounds() throws Exception { Source source = Okio.source(new ByteArrayInputStream(new byte[100])); try { source.read(new Buffer(), -1); fail(); } catch (IllegalArgumentException expected) { } }