@Contract(threading=SAFE) public final class SharedOutputBuffer extends ExpandableBuffer implements ContentOutputBuffer
ExpandableBuffer.Mode
Constructor and Description |
---|
SharedOutputBuffer(int bufferSize) |
SharedOutputBuffer(ReentrantLock lock,
int initialBufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
abort() |
int |
capacity()
Returns available capacity of this buffer.
|
void |
flush(DataStreamChannel channel) |
boolean |
hasData()
Determines if the buffer contains data.
|
boolean |
isEndStream() |
int |
length()
Returns the length of this buffer.
|
void |
reset() |
void |
write(byte[] b,
int off,
int len)
Writes
len bytes from the specified byte array
starting at offset off to this buffer. |
void |
write(int b)
Writes the specified byte to this buffer.
|
void |
writeCompleted()
Indicates the content has been fully written.
|
buffer, clear, ensureAdjustedCapacity, ensureCapacity, expand, mode, setInputMode, setOutputMode, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
length, reset
public SharedOutputBuffer(ReentrantLock lock, int initialBufferSize)
public SharedOutputBuffer(int bufferSize)
public void flush(DataStreamChannel channel) throws IOException
IOException
public void write(byte[] b, int off, int len) throws IOException
ContentOutputBuffer
len
bytes from the specified byte array
starting at offset off
to this buffer.
If off
is negative, or len
is negative, or
off+len
is greater than the length of the array
b
, this method can throw a runtime exception. The exact type
of runtime exception thrown by this method depends on implementation.
write
in interface ContentOutputBuffer
b
- the data.off
- the start offset in the data.len
- the number of bytes to write.IOException
- if an I/O error occurs.public void write(int b) throws IOException
ContentOutputBuffer
write
in interface ContentOutputBuffer
b
- the byte
.IOException
- if an I/O error occurs.public void writeCompleted() throws IOException
ContentOutputBuffer
writeCompleted
in interface ContentOutputBuffer
IOException
- if an I/O error occurs.public boolean hasData()
ExpandableBuffer
Sets the mode to output.
hasData
in class ExpandableBuffer
true
if there is data in the buffer,
false
otherwise.public int capacity()
ExpandableBuffer
capacity
in class ExpandableBuffer
public int length()
ExpandableBuffer
Sets the mode to output.
length
in class ExpandableBuffer
public void abort()
public void reset()
public boolean isEndStream()
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.