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,
ByteBuffer input,
ByteBuffer output) |
ByteArrayEndPoint(Scheduler timer,
long idleTimeoutMs,
String input,
int outputSize) |
ByteArrayEndPoint(String input,
int outputSize) |
Modifier and Type | Method and Description |
---|---|
void |
addInput(ByteBuffer in) |
void |
addInput(String s) |
void |
addInput(String s,
Charset charset) |
void |
addInputAndExecute(ByteBuffer in) |
void |
addInputEOF() |
void |
doClose() |
void |
doShutdownOutput() |
int |
fill(ByteBuffer buffer)
Fill the passed buffer with data from this endpoint.
|
boolean |
flush(ByteBuffer... buffers)
Flush data from the passed header/buffer to this endpoint.
|
InetSocketAddress |
getLocalAddress() |
ByteBuffer |
getOutput() |
String |
getOutputString() |
String |
getOutputString(Charset charset) |
InetSocketAddress |
getRemoteAddress() |
Object |
getTransport() |
boolean |
hasMore() |
boolean |
isGrowOutput() |
void |
reset() |
void |
setGrowOutput(boolean growOutput) |
void |
setOutput(ByteBuffer out) |
ByteBuffer |
takeOutput() |
String |
takeOutputString() |
String |
takeOutputString(Charset charset) |
String |
toString() |
ByteBuffer |
waitForOutput(long time,
TimeUnit unit)
Wait for some output
|
checkFill, checkFlush, close, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getWriteFlusher, isFillInterested, isInputShutdown, isOpen, isOptimizedForDirectBuffers, isOutputShutdown, onClose, onOpen, setConnection, shutdownOutput, toConnectionString, toEndPointString, tryFillInterested, upgrade, write
getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeout
equals, 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(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, String input, int outputSize)
public ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, ByteBuffer input, ByteBuffer output)
public void doShutdownOutput()
public void doClose()
public InetSocketAddress getLocalAddress()
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public InetSocketAddress getRemoteAddress()
EndPoint
is bound, or null
if this EndPoint
does not represent a network connection.public void addInputEOF()
public void addInput(ByteBuffer in)
in
- The in to set.public void addInputAndExecute(ByteBuffer in)
public void addInput(String s)
public ByteBuffer getOutput()
public String getOutputString()
public String getOutputString(Charset charset)
charset
- the charset to encode the output aspublic ByteBuffer takeOutput()
public ByteBuffer waitForOutput(long time, TimeUnit unit) throws InterruptedException
time
- Time to waitunit
- Units for time to waitInterruptedException
- if interruptedpublic String takeOutputString()
public String takeOutputString(Charset charset)
charset
- the charset to encode the output aspublic void setOutput(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(ByteBuffer buffer) throws 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.IOException
- if the endpoint is closed.public boolean flush(ByteBuffer... buffers) throws IOException
EndPoint
buffers
- the buffers to flushIOException
- If the endpoint is closed or output is shutdown.public void reset()
public Object getTransport()
public boolean isGrowOutput()
public void setGrowOutput(boolean growOutput)
growOutput
- the growOutput to setpublic String toString()
toString
in class AbstractEndPoint
Copyright © 2010 - 2020 Adobe. All Rights Reserved