class Relay.RelaySource
extends java.lang.Object
implements okio.Source
Modifier and Type | Field and Description |
---|---|
private FileOperator |
fileOperator
The operator to read and write the shared file.
|
private long |
sourcePos
The next byte to read.
|
private okio.Timeout |
timeout |
Constructor and Description |
---|
RelaySource() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
long |
read(okio.Buffer sink,
long byteCount)
Selects where to find the bytes for a read and read them.
|
okio.Timeout |
timeout() |
private final okio.Timeout timeout
private FileOperator fileOperator
private long sourcePos
upstreamPos
.public long read(okio.Buffer sink, long byteCount) throws java.io.IOException
sink
.
sink
and the number of bytes
copied is returned.
If upstream would be selected but another thread is already reading upstream this will block until that read completes. It is possible to time out while waiting for that.
read
in interface okio.Source
java.io.IOException
public okio.Timeout timeout()
timeout
in interface okio.Source
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface okio.Source
java.io.IOException