@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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitlength, resetpublic SharedOutputBuffer(ReentrantLock lock, int initialBufferSize)
public SharedOutputBuffer(int bufferSize)
public boolean isEndStream()
public void flush(DataStreamChannel channel) throws IOException
IOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
ContentOutputBufferlen 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 ContentOutputBufferb - 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
ContentOutputBufferwrite in interface ContentOutputBufferb - the byte.IOException - if an I/O error occurs.public void writeCompleted()
throws IOException
ContentOutputBufferwriteCompleted in interface ContentOutputBufferIOException - if an I/O error occurs.public boolean hasData()
ExpandableBufferSets the mode to output.
hasData in class ExpandableBuffertrue if there is data in the buffer,
false otherwise.public int capacity()
ExpandableBuffercapacity in class ExpandableBufferpublic int length()
ExpandableBufferSets the mode to output.
length in class ExpandableBufferpublic void abort()
public void reset()
Copyright © 2005–2021 The Apache Software Foundation. All rights reserved.