Class ByteArrayEndPoint
java.lang.Object
org.eclipse.jetty.io.IdleTimeout
org.eclipse.jetty.io.AbstractEndPoint
org.eclipse.jetty.io.ByteArrayEndPoint
- All Implemented Interfaces:
Closeable, AutoCloseable, EndPoint
- Direct Known Subclasses:
LocalConnector.LocalEndPoint
ByteArrayEndPoint.
-
Nested Class Summary
Nested classes/interfaces inherited from interface EndPoint
EndPoint.Pipe, EndPoint.SslSessionData, EndPoint.Wrapper -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayEndPoint(byte[] input, int outputSize) ByteArrayEndPoint(String input, int outputSize) ByteArrayEndPoint(Scheduler scheduler, long idleTimeoutMs) ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, byte[] input, int outputSize) ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, String input, int outputSize) ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, ByteBuffer input, ByteBuffer output) -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidaddInput(ByteBuffer in) voidvoidvoidvoiddoClose()voidprotected voidintfill(ByteBuffer buffer) Fills the passed buffer with data from this endpoint.booleanflush(ByteBuffer... buffers) Flushes data from the passed header/buffer to this endpoint.getOutputString(Charset charset) booleanhasMore()booleanprotected voidprotected voidvoidreset()voidsetGrowOutput(boolean growOutput) Set the growOutput to set.voidsetOutput(ByteBuffer out) takeOutputString(Charset charset) toString()waitForOutput(long time, TimeUnit unit) Wait for some outputMethods inherited from class AbstractEndPoint
close, close, doShutdownInput, fillInterested, getConnection, getCreatedTimeStamp, getFillInterest, getLocalAddress, getRemoteAddress, getWriteFlusher, isFillInterested, isInputShutdown, isOpen, isOutputShutdown, onClose, onClose, onIdleExpired, onOpen, setConnection, shutdownInput, shutdownOutput, toConnectionString, toEndPointString, tryFillInterested, upgrade, writeMethods inherited from class IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeoutMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface EndPoint
getIdleTimeout, getSslSessionData, isSecure, receive, send, setIdleTimeout, write
-
Constructor Details
-
ByteArrayEndPoint
public ByteArrayEndPoint() -
ByteArrayEndPoint
public ByteArrayEndPoint(byte[] input, int outputSize) - Parameters:
input- the input bytesoutputSize- the output size
-
ByteArrayEndPoint
- Parameters:
input- the input string (converted to bytes using default encoding charset)outputSize- the output size
-
ByteArrayEndPoint
-
ByteArrayEndPoint
-
ByteArrayEndPoint
-
ByteArrayEndPoint
-
-
Method Details
-
getLocalSocketAddress
- Specified by:
getLocalSocketAddressin interfaceEndPoint- Specified by:
getLocalSocketAddressin classAbstractEndPoint- Returns:
- the local SocketAddress to which this
EndPointis bound ornullif thisEndPointis not bound to a Socket address.
-
getRemoteSocketAddress
- Specified by:
getRemoteSocketAddressin interfaceEndPoint- Specified by:
getRemoteSocketAddressin classAbstractEndPoint- Returns:
- The remote SocketAddress to which this
EndPointis connected, ornullif thisEndPointis not connected to a Socket address.
-
doShutdownOutput
public void doShutdownOutput()- Overrides:
doShutdownOutputin classAbstractEndPoint
-
doClose
public void doClose()- Overrides:
doClosein classAbstractEndPoint
-
onIncompleteFlush
protected void onIncompleteFlush()- Specified by:
onIncompleteFlushin classAbstractEndPoint
-
execute
-
needsFillInterest
- Specified by:
needsFillInterestin classAbstractEndPoint- Throws:
IOException
-
addInputEOF
public void addInputEOF() -
addInput
- Parameters:
in- The in to set.
-
addInput
-
addInput
-
addInputAndExecute
-
addInputAndExecute
-
getOutput
- Returns:
- Returns the out.
-
getOutputString
- Returns:
- Returns the out.
-
getOutputString
-
takeOutput
- Returns:
- Returns the out.
-
waitForOutput
Wait for some output- Parameters:
time- Time to waitunit- Units for time to wait- Returns:
- The buffer of output
- Throws:
InterruptedException- if interrupted
-
takeOutputString
- Returns:
- Returns the out.
-
takeOutputString
-
setOutput
- Parameters:
out- The out to set.
-
hasMore
public boolean hasMore()- Returns:
trueif there are bytes remaining to be read from the encoded input
-
fill
Description copied from interface:EndPointFills the passed buffer with data from this endpoint.
The bytes are appended to any data already in the buffer by writing from the buffers limit up to its capacity. The limit is updated to include the filled bytes.
- Parameters:
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.- Returns:
- an
intvalue indicating the number of bytes filled or -1 if EOF is read or the input is shutdown. - Throws:
IOException- if the endpoint is closed.
-
flush
Description copied from interface:EndPointFlushes data from the passed header/buffer to this endpoint.
As many bytes as can be consumed are taken from the header/buffer position up until the buffer limit. The header/buffers position is updated to indicate how many bytes have been consumed.
- Parameters:
buffers- the buffers to flush- Returns:
- True IFF all the buffers have been consumed and the endpoint has flushed the data to its destination (ie is not buffering any data).
- Throws:
IOException- If the endpoint is closed or output is shutdown.
-
reset
public void reset()- Overrides:
resetin classAbstractEndPoint
-
getTransport
- Returns:
- The underlying transport object (socket, channel, etc.)
-
isGrowOutput
public boolean isGrowOutput()- Returns:
- the growOutput
-
setGrowOutput
public void setGrowOutput(boolean growOutput) Set the growOutput to set.- Parameters:
growOutput- the growOutput to set
-
toString
- Overrides:
toStringin classAbstractEndPoint
-