Package org.apache.hc.core5.http.nio
Interface DataStreamChannel
-
- All Superinterfaces:
StreamChannel<java.nio.ByteBuffer>
- All Known Subinterfaces:
H2StreamChannel
- All Known Implementing Classes:
AbstractH2StreamMultiplexer.H2StreamChannelImpl
@Contract(threading=SAFE) public interface DataStreamChannel extends StreamChannel<java.nio.ByteBuffer>
Abstract byte stream channelImplementations are expected to be thread-safe.
- Since:
- 5.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
endStream(java.util.List<? extends Header> trailers)
Terminates the underlying data stream and optionally writes a closing sequence with the given trailers.void
requestOutput()
Signals intent by the data producer to produce more data.int
write(java.nio.ByteBuffer src)
Writes data from the buffer through this channel into the underlying byte stream.-
Methods inherited from interface org.apache.hc.core5.http.nio.StreamChannel
endStream
-
-
-
-
Method Detail
-
requestOutput
void requestOutput()
Signals intent by the data producer to produce more data. Once the channel is able to accept data its handler is expected to trigger an event to notify the data producer.
-
write
int write(java.nio.ByteBuffer src) throws java.io.IOException
Writes data from the buffer through this channel into the underlying byte stream. If the underlying byte stream is temporarily unable to accept more data it can return zero to indicate that no data could be written to the data stream. The data producer can choose to callrequestOutput()
to signal its intent to produce more data.- Specified by:
write
in interfaceStreamChannel<java.nio.ByteBuffer>
- Parameters:
src
- source of data- Returns:
- The number of bytes written, possibly zero
- Throws:
java.io.IOException
-
endStream
void endStream(java.util.List<? extends Header> trailers) throws java.io.IOException
Terminates the underlying data stream and optionally writes a closing sequence with the given trailers.Please note that some data streams may not support trailers and may silently ignore the trailers parameter.
- Throws:
java.io.IOException
-
-