public final class Okio
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static Sink |
appendingSink(java.io.File file)
Returns a sink that appends to
file . |
static Sink |
blackhole()
Returns a sink that writes nowhere.
|
static BufferedSink |
buffer(Sink sink)
Returns a new sink that buffers writes to
sink . |
static BufferedSource |
buffer(Source source)
Returns a new source that buffers reads from
source . |
static Sink |
sink(java.io.File file)
Returns a sink that writes to
file . |
static Sink |
sink(java.io.OutputStream out)
Returns a sink that writes to
out . |
static Sink |
sink(java.nio.file.Path path,
java.nio.file.OpenOption... options)
Returns a sink that writes to
path . |
static Sink |
sink(java.net.Socket socket)
Returns a sink that writes to
socket . |
static Source |
source(java.io.File file)
Returns a source that reads from
file . |
static Source |
source(java.io.InputStream in)
Returns a source that reads from
in . |
static Source |
source(java.nio.file.Path path,
java.nio.file.OpenOption... options)
Returns a source that reads from
path . |
static Source |
source(java.net.Socket socket)
Returns a source that reads from
socket . |
public static BufferedSource buffer(Source source)
source
. The returned
source will perform bulk reads into its in-memory buffer. Use this wherever
you read a source to get an ergonomic and efficient access to data.public static BufferedSink buffer(Sink sink)
sink
. The returned sink
will batch writes to sink
. Use this wherever you write to a sink to
get an ergonomic and efficient access to data.public static Sink sink(java.io.OutputStream out)
out
.public static Sink sink(java.net.Socket socket) throws java.io.IOException
socket
. Prefer this over sink(OutputStream)
because this method honors timeouts. When the socket
write times out, the socket is asynchronously closed by a watchdog thread.java.io.IOException
public static Source source(java.io.InputStream in)
in
.public static Source source(java.io.File file) throws java.io.FileNotFoundException
file
.java.io.FileNotFoundException
@IgnoreJRERequirement public static Source source(java.nio.file.Path path, java.nio.file.OpenOption... options) throws java.io.IOException
path
.java.io.IOException
public static Sink sink(java.io.File file) throws java.io.FileNotFoundException
file
.java.io.FileNotFoundException
public static Sink appendingSink(java.io.File file) throws java.io.FileNotFoundException
file
.java.io.FileNotFoundException
@IgnoreJRERequirement public static Sink sink(java.nio.file.Path path, java.nio.file.OpenOption... options) throws java.io.IOException
path
.java.io.IOException
public static Sink blackhole()
public static Source source(java.net.Socket socket) throws java.io.IOException
socket
. Prefer this over source(InputStream)
because this method honors timeouts. When the socket
read times out, the socket is asynchronously closed by a watchdog thread.java.io.IOException
Copyright © 2019. All Rights Reserved.