Package org.apache.http.impl.nio.codecs
Class ChunkEncoder
- java.lang.Object
-
- org.apache.http.impl.nio.codecs.AbstractContentEncoder
-
- org.apache.http.impl.nio.codecs.ChunkEncoder
-
- All Implemented Interfaces:
ContentEncoder
public class ChunkEncoder extends AbstractContentEncoder
Implements chunked transfer coding. The content is sent in small chunks. Entities transferred using this decoder can be of unlimited length.- Since:
- 4.0
-
-
Constructor Summary
Constructors Constructor Description ChunkEncoder(java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, HttpTransportMetricsImpl metrics)ChunkEncoder(java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, HttpTransportMetricsImpl metrics, int fragementSizeHint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplete()Terminates the content stream.java.lang.StringtoString()intwrite(java.nio.ByteBuffer src)Writes a portion of entity content to the underlying channel.-
Methods inherited from class org.apache.http.impl.nio.codecs.AbstractContentEncoder
isCompleted
-
-
-
-
Constructor Detail
-
ChunkEncoder
public ChunkEncoder(java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, HttpTransportMetricsImpl metrics, int fragementSizeHint)- Parameters:
channel- underlying channel.buffer- session buffer.metrics- transport metrics.fragementSizeHint- fragment size hint defining an minimal size of a fragment that should be written out directly to the channel bypassing the session buffer. Value0disables fragment buffering.- Since:
- 4.3
-
ChunkEncoder
public ChunkEncoder(java.nio.channels.WritableByteChannel channel, SessionOutputBuffer buffer, HttpTransportMetricsImpl metrics)
-
-
Method Detail
-
write
public int write(java.nio.ByteBuffer src) throws java.io.IOExceptionDescription copied from interface:ContentEncoderWrites a portion of entity content to the underlying channel.- Parameters:
src- The buffer from which content is to be retrieved- Returns:
- The number of bytes read, possibly zero
- Throws:
java.io.IOException- if I/O error occurs while writing content
-
complete
public void complete() throws java.io.IOExceptionDescription copied from interface:ContentEncoderTerminates the content stream.- Specified by:
completein interfaceContentEncoder- Overrides:
completein classAbstractContentEncoder- Throws:
java.io.IOException- if I/O error occurs while writing content
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-