Package org.eclipse.jetty.quic.common
Class QuicStreamEndPoint
- java.lang.Object
-
- org.eclipse.jetty.io.IdleTimeout
-
- org.eclipse.jetty.io.AbstractEndPoint
-
- org.eclipse.jetty.quic.common.QuicStreamEndPoint
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,EndPoint
public class QuicStreamEndPoint extends AbstractEndPoint
An
EndPoint
implementation on top of a QUIC stream.The correspondent
Connection
associated to this QuicStreamEndPoint parses and generates the protocol specific bytes transported by QUIC.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.EndPoint
EndPoint.Wrapper
-
-
Constructor Summary
Constructors Constructor Description QuicStreamEndPoint(Scheduler scheduler, QuicSession session, long streamId)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close(long error, java.lang.Throwable failure)
void
closed(java.lang.Throwable failure)
int
fill(java.nio.ByteBuffer buffer)
Fill the passed buffer with data from this endpoint.void
fillInterested(Callback callback)
Requests callback methods to be invoked when a call toEndPoint.fill(ByteBuffer)
would return data or EOF.boolean
flush(java.nio.ByteBuffer... buffers)
Flush data from the passed header/buffer to this endpoint.java.net.SocketAddress
getLocalSocketAddress()
QuicSession
getQuicSession()
java.net.SocketAddress
getRemoteSocketAddress()
long
getStreamId()
java.lang.Object
getTransport()
boolean
isStreamFinished()
protected void
needsFillInterest()
void
onClose(java.lang.Throwable failure)
Callback method invoked when thisEndPoint
is closed.protected void
onIncompleteFlush()
boolean
onReadable()
void
onWritable()
void
opened()
void
shutdownInput(long error)
void
shutdownOutput(long error)
java.lang.String
toString()
boolean
tryFillInterested(Callback callback)
Requests callback methods to be invoked when a call toEndPoint.fill(ByteBuffer)
would return data or EOF.void
write(Callback callback, java.util.List<java.nio.ByteBuffer> buffers, boolean last)
-
Methods inherited from class org.eclipse.jetty.io.AbstractEndPoint
close, close, doClose, doShutdownInput, doShutdownOutput, getConnection, getCreatedTimeStamp, getFillInterest, getLocalAddress, getRemoteAddress, getWriteFlusher, isFillInterested, isInputShutdown, isOpen, isOutputShutdown, onClose, onIdleExpired, onOpen, reset, setConnection, shutdownInput, shutdownOutput, toConnectionString, toEndPointString, 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 Detail
-
QuicStreamEndPoint
public QuicStreamEndPoint(Scheduler scheduler, QuicSession session, long streamId)
-
-
Method Detail
-
opened
public void opened()
-
closed
public void closed(java.lang.Throwable failure)
-
getQuicSession
public QuicSession getQuicSession()
-
getStreamId
public long getStreamId()
-
getLocalSocketAddress
public java.net.SocketAddress 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
public java.net.SocketAddress 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.
-
isStreamFinished
public boolean isStreamFinished()
-
shutdownInput
public void shutdownInput(long error)
-
shutdownOutput
public void shutdownOutput(long error)
-
close
public void close(long error, java.lang.Throwable failure)
-
onClose
public void onClose(java.lang.Throwable failure)
Description copied from interface:EndPoint
Callback method invoked when this
EndPoint
is closed.- Specified by:
onClose
in interfaceEndPoint
- Overrides:
onClose
in classAbstractEndPoint
- Parameters:
failure
- The reason for the close, or null if a normal close.- See Also:
EndPoint.onOpen()
-
fill
public int fill(java.nio.ByteBuffer buffer) throws java.io.IOException
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:
java.io.IOException
- if the endpoint is closed.
-
flush
public boolean flush(java.nio.ByteBuffer... buffers) throws java.io.IOException
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:
java.io.IOException
- If the endpoint is closed or output is shutdown.
-
write
public void write(Callback callback, java.util.List<java.nio.ByteBuffer> buffers, boolean last)
-
getTransport
public java.lang.Object getTransport()
- Returns:
- The underlying transport object (socket, channel, etc.)
-
onWritable
public void onWritable()
-
onReadable
public boolean onReadable()
- Returns:
- whether this endPoint is interested in reads
-
fillInterested
public void fillInterested(Callback callback)
Description copied from interface:EndPoint
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer)
would return data or EOF.- Specified by:
fillInterested
in interfaceEndPoint
- Overrides:
fillInterested
in classAbstractEndPoint
- Parameters:
callback
- the callback to call when an error occurs or we are readable. The callback may implement theInvocable
interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
-
tryFillInterested
public boolean tryFillInterested(Callback callback)
Description copied from interface:EndPoint
Requests callback methods to be invoked when a call to
EndPoint.fill(ByteBuffer)
would return data or EOF.- Specified by:
tryFillInterested
in interfaceEndPoint
- Overrides:
tryFillInterested
in classAbstractEndPoint
- Parameters:
callback
- the callback to call when an error occurs or we are readable. The callback may implement theInvocable
interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.- Returns:
- true if set
-
onIncompleteFlush
protected void onIncompleteFlush()
- Specified by:
onIncompleteFlush
in classAbstractEndPoint
-
needsFillInterest
protected void needsFillInterest()
- Specified by:
needsFillInterest
in classAbstractEndPoint
-
toString
public java.lang.String toString()
- Overrides:
toString
in classAbstractEndPoint
-
-