public class ByteArrayEndPoint extends AbstractEndPoint
Constructor and Description |
---|
ByteArrayEndPoint() |
ByteArrayEndPoint(byte[] input,
int outputSize) |
ByteArrayEndPoint(Scheduler scheduler,
long idleTimeoutMs) |
ByteArrayEndPoint(Scheduler timer,
long idleTimeoutMs,
byte[] input,
int outputSize) |
ByteArrayEndPoint(Scheduler timer,
long idleTimeoutMs,
java.nio.ByteBuffer input,
java.nio.ByteBuffer output) |
ByteArrayEndPoint(Scheduler timer,
long idleTimeoutMs,
java.lang.String input,
int outputSize) |
ByteArrayEndPoint(java.lang.String input,
int outputSize) |
Modifier and Type | Method and Description |
---|---|
void |
addInput(java.nio.ByteBuffer in) |
void |
addInput(java.lang.String s) |
void |
addInput(java.lang.String s,
java.nio.charset.Charset charset) |
void |
addInputAndExecute(java.nio.ByteBuffer in) |
void |
addInputEOF() |
void |
doClose() |
void |
doShutdownOutput() |
protected void |
execute(java.lang.Runnable task) |
int |
fill(java.nio.ByteBuffer buffer)
Fill the passed buffer with data from this endpoint.
|
boolean |
flush(java.nio.ByteBuffer... buffers)
Flush data from the passed header/buffer to this endpoint.
|
java.net.InetSocketAddress |
getLocalAddress() |
java.nio.ByteBuffer |
getOutput() |
java.lang.String |
getOutputString() |
java.lang.String |
getOutputString(java.nio.charset.Charset charset) |
java.net.InetSocketAddress |
getRemoteAddress() |
java.lang.Object |
getTransport() |
boolean |
hasMore() |
boolean |
isGrowOutput() |
protected void |
needsFillInterest() |
protected void |
onIncompleteFlush() |
void |
reset() |
void |
setGrowOutput(boolean growOutput) |
void |
setOutput(java.nio.ByteBuffer out) |
java.nio.ByteBuffer |
takeOutput() |
java.lang.String |
takeOutputString() |
java.lang.String |
takeOutputString(java.nio.charset.Charset charset) |
java.lang.String |
toString() |
java.nio.ByteBuffer |
waitForOutput(long time,
java.util.concurrent.TimeUnit unit)
Wait for some output
|
checkFill, checkFlush, close, close, doShutdownInput, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getWriteFlusher, isFillInterested, isInputShutdown, isOpen, isOptimizedForDirectBuffers, isOutputShutdown, onClose, onClose, onIdleExpired, onOpen, setConnection, shutdownInput, shutdownOutput, toConnectionString, toEndPointString, tryFillInterested, upgrade, write
checkIdleTimeout, getIdleFor, getIdleTimeout, getIdleTimestamp, getScheduler, notIdle, setIdleTimeout
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getIdleTimeout, setIdleTimeout
public ByteArrayEndPoint()
public ByteArrayEndPoint(byte[] input, int outputSize)
input
- the input bytesoutputSize
- the output sizepublic ByteArrayEndPoint(java.lang.String input, int outputSize)
input
- the input string (converted to bytes using default encoding charset)outputSize
- the output sizepublic ByteArrayEndPoint(Scheduler scheduler, long idleTimeoutMs)
public ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, byte[] input, int outputSize)
public ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, java.lang.String input, int outputSize)
public ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, java.nio.ByteBuffer input, java.nio.ByteBuffer output)
public void doShutdownOutput()
doShutdownOutput
in class AbstractEndPoint
public void doClose()
doClose
in class AbstractEndPoint
public java.net.InetSocketAddress getLocalAddress()
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public java.net.InetSocketAddress getRemoteAddress()
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.protected void onIncompleteFlush()
onIncompleteFlush
in class AbstractEndPoint
protected void execute(java.lang.Runnable task)
protected void needsFillInterest() throws java.io.IOException
needsFillInterest
in class AbstractEndPoint
java.io.IOException
public void addInputEOF()
public void addInput(java.nio.ByteBuffer in)
in
- The in to set.public void addInputAndExecute(java.nio.ByteBuffer in)
public void addInput(java.lang.String s)
public void addInput(java.lang.String s, java.nio.charset.Charset charset)
public java.nio.ByteBuffer getOutput()
public java.lang.String getOutputString()
public java.lang.String getOutputString(java.nio.charset.Charset charset)
charset
- the charset to encode the output aspublic java.nio.ByteBuffer takeOutput()
public java.nio.ByteBuffer waitForOutput(long time, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
time
- Time to waitunit
- Units for time to waitjava.lang.InterruptedException
- if interruptedpublic java.lang.String takeOutputString()
public java.lang.String takeOutputString(java.nio.charset.Charset charset)
charset
- the charset to encode the output aspublic void setOutput(java.nio.ByteBuffer out)
out
- The out to set.public boolean hasMore()
true
if there are bytes remaining to be read from the encoded inputpublic int fill(java.nio.ByteBuffer buffer) throws java.io.IOException
EndPoint
buffer
- The buffer to fill. The position and limit are modified during the fill. After the
operation, the position is unchanged and the limit is increased to reflect the new data filled.int
value indicating the number of bytes
filled or -1 if EOF is read or the input is shutdown.java.io.IOException
- if the endpoint is closed.public boolean flush(java.nio.ByteBuffer... buffers) throws java.io.IOException
EndPoint
buffers
- the buffers to flushjava.io.IOException
- If the endpoint is closed or output is shutdown.public void reset()
reset
in class AbstractEndPoint
public java.lang.Object getTransport()
public boolean isGrowOutput()
public void setGrowOutput(boolean growOutput)
growOutput
- the growOutput to setpublic java.lang.String toString()
toString
in class AbstractEndPoint
Copyright © 1995–2023 Webtide. All rights reserved.