public abstract class DataSink
extends java.lang.Object
An abstraction over the byte stream reading operations, this class allows for a flexible way to read bytes from a BufferedSource
.
create(File)
method can be used for writing data to a file.
readAll(BufferedSource)
method.
Constructor and Description |
---|
DataSink() |
Modifier and Type | Method and Description |
---|---|
static DataSink |
create(java.io.File file)
Create a
DataSink instance that writes data to a file. |
abstract void |
readAll(okio.BufferedSource source)
Reads all bytes from a source
|
public abstract void readAll(okio.BufferedSource source) throws java.io.IOException
Do any reading here.
Closeable.close()
on the source
argument, it will be closed for you.source
- the sourcejava.io.IOException
- the io exceptionpublic static DataSink create(java.io.File file)
DataSink
instance that writes data to a file.file
- a file where the data will be written. Must not be null.DataSink
that will write to the given file.java.lang.IllegalArgumentException
- on a null file
argument.