@ThreadSafe
public class NhttpSharedOutputBuffer
extends org.apache.http.nio.util.ExpandableBuffer
implements org.apache.http.nio.util.ContentOutputBuffer
ContentOutputBuffer
interface that can be
shared by multiple threads, usually the I/O dispatch of an I/O reactor and
a worker thread.
The I/O dispatch thread is expected to transfer data from the buffer to
ContentEncoder
by calling produceContent(ContentEncoder)
.
The worker thread is expected to write data to the buffer by calling
write(int)
, write(byte[], int, int)
or writeCompleted()
In case of an abnormal situation or when no longer needed the buffer must be
shut down using shutdown()
method.
Please note that SharedOutputBuffer
class was copied here renamed as
NhttpSharedOutputBuffer from httpcore-nio in order to fix
https://github.com/wso2/product-ei/issues/1367, without having to do an API change in httpcore-nio component.
Constructor and Description |
---|
NhttpSharedOutputBuffer(int buffersize) |
NhttpSharedOutputBuffer(int buffersize,
org.apache.http.nio.util.ByteBufferAllocator allocator) |
NhttpSharedOutputBuffer(int buffersize,
org.apache.http.nio.IOControl ioctrl,
org.apache.http.nio.util.ByteBufferAllocator allocator)
Deprecated.
|
NhttpSharedOutputBuffer(int buffersize,
org.apache.http.nio.IOControl ioctrl,
org.apache.http.nio.util.ByteBufferAllocator allocator,
int timeout) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
int |
capacity() |
void |
close() |
void |
flush() |
boolean |
hasData() |
int |
length() |
int |
produceContent(org.apache.http.nio.ContentEncoder encoder)
Deprecated.
|
int |
produceContent(org.apache.http.nio.ContentEncoder encoder,
org.apache.http.nio.IOControl ioctrl) |
void |
reset() |
void |
shutdown() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeCompleted() |
public NhttpSharedOutputBuffer(int buffersize, org.apache.http.nio.IOControl ioctrl, org.apache.http.nio.util.ByteBufferAllocator allocator, int timeout)
@Deprecated public NhttpSharedOutputBuffer(int buffersize, org.apache.http.nio.IOControl ioctrl, org.apache.http.nio.util.ByteBufferAllocator allocator)
public NhttpSharedOutputBuffer(int buffersize, org.apache.http.nio.util.ByteBufferAllocator allocator)
public NhttpSharedOutputBuffer(int buffersize)
public void reset()
reset
in interface org.apache.http.nio.util.ContentOutputBuffer
public boolean hasData()
hasData
in class org.apache.http.nio.util.ExpandableBuffer
public int available()
available
in interface org.apache.http.nio.util.BufferInfo
available
in class org.apache.http.nio.util.ExpandableBuffer
public int capacity()
capacity
in interface org.apache.http.nio.util.BufferInfo
capacity
in class org.apache.http.nio.util.ExpandableBuffer
public int length()
length
in interface org.apache.http.nio.util.BufferInfo
length
in class org.apache.http.nio.util.ExpandableBuffer
@Deprecated public int produceContent(org.apache.http.nio.ContentEncoder encoder) throws IOException
produceContent
in interface org.apache.http.nio.util.ContentOutputBuffer
IOException
public int produceContent(org.apache.http.nio.ContentEncoder encoder, org.apache.http.nio.IOControl ioctrl) throws IOException
IOException
public void close()
public void shutdown()
public void write(byte[] b, int off, int len) throws IOException
write
in interface org.apache.http.nio.util.ContentOutputBuffer
IOException
public void write(byte[] b) throws IOException
IOException
public void write(int b) throws IOException
write
in interface org.apache.http.nio.util.ContentOutputBuffer
IOException
public void flush() throws IOException
flush
in interface org.apache.http.nio.util.ContentOutputBuffer
IOException
public void writeCompleted() throws IOException
writeCompleted
in interface org.apache.http.nio.util.ContentOutputBuffer
IOException
Copyright © 2005–2020 Apache Software Foundation. All rights reserved.