Package org.refcodes.io
Class BidirectionalStreamConnectionByteTransceiverImpl
- java.lang.Object
-
- org.refcodes.component.AbstractConnectableAutomaton
-
- org.refcodes.io.AbstractInputStreamByteReceiver
-
- org.refcodes.io.BidirectionalStreamConnectionByteTransceiverImpl
-
- All Implemented Interfaces:
Flushable
,org.refcodes.component.BidirectionalConnectionComponent<InputStream,OutputStream>
,org.refcodes.component.BidirectionalConnectionComponent.BidirectionalConnectionAutomaton<InputStream,OutputStream>
,org.refcodes.component.BidirectionalConnectionOpenable<InputStream,OutputStream>
,org.refcodes.component.BidirectionalConnectionOpenable.BidirectionalConnectionOpenAutomaton<InputStream,OutputStream>
,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.Flushable
,org.refcodes.component.OpenedAccessor
,BidirectionalConnectionByteTransceiver<InputStream,OutputStream>
,BidirectionalStreamConnectionByteTransceiver
,ByteBlockConsumer
,ByteBlockProvider
,ByteBlockReceiver
,ByteBlockSender
,ByteConsumer
,ByteDatagramConsumer
,ByteDatagramProvider
,ByteDatagramReceiver
,ByteDatagramSender
,ByteProvider
,ByteReceiver
,ByteSender
,ByteTransceiver
,Receivable
,Sendable
,org.refcodes.mixin.Releaseable
public class BidirectionalStreamConnectionByteTransceiverImpl extends AbstractInputStreamByteReceiver implements BidirectionalStreamConnectionByteTransceiver
The Class BidirectionalStreamConnectionByteTransceiverImpl.- Author:
- steiner
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.component.BidirectionalConnectionComponent
org.refcodes.component.BidirectionalConnectionComponent.BidirectionalConnectionAutomaton<INPUT extends Object,OUTPUT extends Object>
-
Nested classes/interfaces inherited from interface org.refcodes.component.BidirectionalConnectionOpenable
org.refcodes.component.BidirectionalConnectionOpenable.BidirectionalConnectionOpenAutomaton<INPUT extends Object,OUTPUT extends Object>
-
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
-
Nested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
-
-
Constructor Summary
Constructors Constructor Description BidirectionalStreamConnectionByteTransceiverImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
boolean
isOpenable(InputStream aInputStream, OutputStream aOutputStream)
void
open(InputStream aInputStream, OutputStream aOutputStream)
protected void
open(OutputStream aOutputStream)
HINT: For testing purposes you can pass an already flushedObjectOutputStream
(viaObjectOutputStream.flush()
) encapsulating aPipedOutputStream
which in turn encapsulates aPipedInputStream
to thisopen(OutputStream)
method.void
writeDatagram(byte aDatagram)
Writes (sends) a byte.-
Methods inherited from class org.refcodes.component.AbstractConnectableAutomaton
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
-
Methods inherited from class org.refcodes.io.AbstractInputStreamByteReceiver
hasDatagram, isOpenable, open, readDatagram, releaseAll
-
Methods inherited from interface org.refcodes.io.ByteConsumer
writeDatagrams
-
Methods inherited from interface org.refcodes.io.ByteDatagramProvider
readDatagram
-
Methods inherited from interface org.refcodes.io.ByteReceiver
readDatagrams, readDatagrams
-
Methods inherited from interface org.refcodes.io.ByteSender
writeDatagrams
-
Methods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUnchecked
-
Methods inherited from interface org.refcodes.component.ConnectionStatusAccessor
getConnectionStatus, isConnectionOpened
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.refcodes.io.Receivable
hasDatagram
-
-
-
-
Method Detail
-
isOpenable
public boolean isOpenable(InputStream aInputStream, OutputStream aOutputStream)
- Specified by:
isOpenable
in interfaceorg.refcodes.component.BidirectionalConnectionOpenable.BidirectionalConnectionOpenAutomaton<InputStream,OutputStream>
-
open
public void open(InputStream aInputStream, OutputStream aOutputStream) throws org.refcodes.component.OpenException
- Specified by:
open
in interfaceorg.refcodes.component.BidirectionalConnectionOpenable<InputStream,OutputStream>
- Throws:
org.refcodes.component.OpenException
-
writeDatagram
public void writeDatagram(byte aDatagram) throws org.refcodes.component.OpenException
Writes (sends) a byte.- Specified by:
writeDatagram
in interfaceByteConsumer
- Specified by:
writeDatagram
in interfaceByteDatagramConsumer
- Parameters:
aDatagram
- The byte to be pushed.- Throws:
org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line (connection, junction, link) caused problems.
-
flush
public void flush() throws org.refcodes.component.OpenException
- Specified by:
flush
in interfaceByteSender
- Specified by:
flush
in interfaceFlushable
- Specified by:
flush
in interfaceorg.refcodes.component.Flushable
- Throws:
org.refcodes.component.OpenException
-
close
public void close() throws org.refcodes.component.CloseException
- Specified by:
close
in interfaceorg.refcodes.component.Closable
- Overrides:
close
in classAbstractInputStreamByteReceiver
- Throws:
org.refcodes.component.CloseException
-
open
protected void open(OutputStream aOutputStream) throws org.refcodes.component.OpenException
HINT: For testing purposes you can pass an already flushedObjectOutputStream
(viaObjectOutputStream.flush()
) encapsulating aPipedOutputStream
which in turn encapsulates aPipedInputStream
to thisopen(OutputStream)
method. This enables you a non-blocking test of theOutputStreamConnectionSenderImpl
connected with theInputStreamConnectionReceiverImpl
counterpart which is being opened with thePipedInputStream
. ATTENTION: For maintainers, please keep the below code in sync with the code fromOutputStreamConnectionSenderImpl.open(java.io.OutputStream)
; except do not set the connection status here, make it protected and do not override anything.- Parameters:
aOutputStream
- the output stream- Throws:
org.refcodes.component.OpenException
- the open exception
-
-