-
- All Superinterfaces:
org.refcodes.io.Availability,org.refcodes.component.Closable,org.refcodes.component.Closable.CloseAutomaton,org.refcodes.component.ClosedAccessor,org.refcodes.component.ConnectableComponent,org.refcodes.component.ConnectableComponent.ConnectableAutomaton,org.refcodes.component.ConnectionStatusAccessor,org.refcodes.component.OpenedAccessor,org.refcodes.io.Receivable,SegmentDestination
- All Known Subinterfaces:
Port<PM>,SegmentTransceiver,SerialReceiver,SerialTransceiver
- All Known Implementing Classes:
AbstractPort,AbstractPortDecorator,CrossoverLoopbackPort,LoopbackPort
public interface SegmentReceiver extends SegmentDestination, org.refcodes.io.Receivable
TheSegmentReceiveris used to receiveSegmentinstances in a unified way.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.component.Closable
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
-
Nested classes/interfaces inherited from interface org.refcodes.component.ClosedAccessor
org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent
org.refcodes.component.ConnectableComponent.ConnectableAutomaton
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description <SEGMENT extends Segment>
SegmentResult<SEGMENT>onReceiveSegment(SEGMENT aSegment)Asynchronously receives aSegment'sSequencedata (does not block this thread) and updates theSegmentby invokingSegment.fromTransmission(Sequence).<SEGMENT extends Segment>
voidonReceiveSegment(SEGMENT aSegment, SegmentConsumer<SEGMENT> aSegmentConsumer)Asynchronously receives aSegment'sSequencedata (does not block this thread) and updates theSegmentby invokingSegment.fromTransmission(Sequence), passing the result to the callbackSegmentConsumer.onSegment(Segment).<SEGMENT extends Segment>
voidreceiveSegmentWithin(long aTimeoutInMs, SEGMENT aSegment)Receives aSegment(and blocks this thread) till all it'sSequencedata has been received and updates theSegmentby invokingSegment.fromTransmission(Sequence).-
Methods inherited from interface org.refcodes.component.Closable
close, closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
getConnectionStatus, isOpened
-
Methods inherited from interface org.refcodes.serial.SegmentDestination
receiveSegment
-
-
-
-
Method Detail
-
receiveSegmentWithin
<SEGMENT extends Segment> void receiveSegmentWithin(long aTimeoutInMs, SEGMENT aSegment) throws TransmissionException, IOException
Receives aSegment(and blocks this thread) till all it'sSequencedata has been received and updates theSegmentby invokingSegment.fromTransmission(Sequence). This method blocks till all bytes are read or the timeout has been reached.- Type Parameters:
SEGMENT- TheSegmenttype describing theSegmentsubclass of implementingSegmenttypes.- Parameters:
aTimeoutInMs- The default timeout for read operations not explicitly called with a timeout argument. With a value of -1 timeout handling is disabled (blocking mode) or a technical timeout occurs (implementation depended).aSegment- TheSegmentto be (re-)initialized with the received data.- Throws:
TransmissionException- Thrown in case the received data cannot be used to (re-)initialize the givenSegment.IOException- thrown in case of I/O issues (e.g. a timeout) while receiving.
-
onReceiveSegment
<SEGMENT extends Segment> void onReceiveSegment(SEGMENT aSegment, SegmentConsumer<SEGMENT> aSegmentConsumer) throws IOException
Asynchronously receives aSegment'sSequencedata (does not block this thread) and updates theSegmentby invokingSegment.fromTransmission(Sequence), passing the result to the callbackSegmentConsumer.onSegment(Segment).- Type Parameters:
SEGMENT- TheSegmenttype describing theSegmentsubclass of implementingSegmenttypes.- Parameters:
aSegment- TheSegmentto be (re-)initialized with the received data.aSegmentConsumer- The callback asynchronously invoked upon having received theSegment.- Throws:
IOException- thrown in case of I/O issues (e.g. a closed connection) while receiving.
-
onReceiveSegment
<SEGMENT extends Segment> SegmentResult<SEGMENT> onReceiveSegment(SEGMENT aSegment) throws IOException
Asynchronously receives aSegment'sSequencedata (does not block this thread) and updates theSegmentby invokingSegment.fromTransmission(Sequence). The result is provided by the returnedSegmentResultinstance providing the (asynchronously) (re-)initialized providedSegmentinstance.- Type Parameters:
SEGMENT- TheSegmenttype describing theSegmentsubclass used.- Parameters:
aSegment- TheSegmentto be (re-)initialized with the received data.- Returns:
- The
SegmentResultwhich provides the result (asynchronously). - Throws:
IOException- thrown in case of I/O issues (e.g. a closed connection) while receiving.
-
-