Package org.eclipse.jetty.io
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 org.eclipse.jetty.io.EndPoint
EndPoint.Wrapper
-
Constructor Summary
ConstructorDescriptionByteArrayEndPoint
(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 TypeMethodDescriptionvoid
void
void
addInput
(ByteBuffer in) void
void
void
doClose()
void
protected void
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.getOutputString
(Charset charset) boolean
hasMore()
boolean
protected void
protected void
void
reset()
void
setGrowOutput
(boolean growOutput) void
setOutput
(ByteBuffer out) takeOutputString
(Charset charset) toString()
waitForOutput
(long time, TimeUnit unit) Wait for some outputMethods inherited from class org.eclipse.jetty.io.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, write
Methods inherited from class org.eclipse.jetty.io.IdleTimeout
checkIdleTimeout, getIdleFor, getIdleTimeout, getScheduler, notIdle, setIdleTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.jetty.io.EndPoint
getIdleTimeout, setIdleTimeout
-
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:
getLocalSocketAddress
in interfaceEndPoint
- Overrides:
getLocalSocketAddress
in classAbstractEndPoint
- Returns:
- the local SocketAddress to which this
EndPoint
is bound ornull
if thisEndPoint
is not bound to a Socket address.
-
getRemoteSocketAddress
- Specified by:
getRemoteSocketAddress
in interfaceEndPoint
- Overrides:
getRemoteSocketAddress
in classAbstractEndPoint
- Returns:
- The remote SocketAddress to which this
EndPoint
is connected, ornull
if thisEndPoint
is not connected to a Socket address.
-
doShutdownOutput
public void doShutdownOutput()- Overrides:
doShutdownOutput
in classAbstractEndPoint
-
doClose
public void doClose()- Overrides:
doClose
in classAbstractEndPoint
-
onIncompleteFlush
protected void onIncompleteFlush()- Specified by:
onIncompleteFlush
in classAbstractEndPoint
-
execute
-
needsFillInterest
- Specified by:
needsFillInterest
in classAbstractEndPoint
- Throws:
IOException
-
addInputEOF
public void addInputEOF() -
addInput
- Parameters:
in
- The in to set.
-
addInput
-
addInput
-
addInputAndExecute
-
getOutput
- Returns:
- Returns the out.
-
getOutputString
- Returns:
- Returns the out.
-
getOutputString
- Parameters:
charset
- the charset to encode the output as- Returns:
- Returns the out.
-
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
- Parameters:
charset
- the charset to encode the output as- Returns:
- Returns the out.
-
setOutput
- Parameters:
out
- The out to set.
-
hasMore
public boolean hasMore()- Returns:
true
if there are bytes remaining to be read from the encoded input
-
fill
Description copied from interface:EndPoint
Fill 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 it's 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
int
value 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:EndPoint
Flush 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:
reset
in classAbstractEndPoint
-
getTransport
- Returns:
- The underlying transport object (socket, channel, etc.)
-
isGrowOutput
public boolean isGrowOutput()- Returns:
- the growOutput
-
setGrowOutput
public void setGrowOutput(boolean growOutput) - Parameters:
growOutput
- the growOutput to set
-
toString
- Overrides:
toString
in classAbstractEndPoint
-