Package org.refcodes.io
Class PrefetchBidirectionalStreamConnectionByteTransceiverImpl
- java.lang.Object
-
- org.refcodes.io.AbstractByteProvider
-
- org.refcodes.io.AbstractByteReceiver
-
- org.refcodes.io.AbstractPrefetchInputStreamByteReceiver
-
- org.refcodes.io.PrefetchBidirectionalStreamConnectionByteTransceiverImpl
-
- All Implemented Interfaces:
java.io.Flushable
,org.refcodes.component.BidirectionalConnectionComponent<java.io.InputStream,java.io.OutputStream>
,org.refcodes.component.BidirectionalConnectionComponent.BidirectionalConnectionAutomaton<java.io.InputStream,java.io.OutputStream>
,org.refcodes.component.BidirectionalConnectionOpenable<java.io.InputStream,java.io.OutputStream>
,org.refcodes.component.BidirectionalConnectionOpenable.BidirectionalConnectionOpenAutomaton<java.io.InputStream,java.io.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<java.io.InputStream,java.io.OutputStream>
,BidirectionalStreamConnectionByteTransceiver
,ByteBlockConsumer
,ByteBlockProvider
,ByteBlockReceiver
,ByteBlockSender
,ByteConsumer
,ByteDatagramConsumer
,ByteDatagramProvider
,ByteDatagramReceiver
,ByteDatagramSender
,ByteProvider
,ByteReceiver
,ByteSender
,ByteTransceiver
,Receivable
,Sendable
,org.refcodes.mixin.Releaseable
public class PrefetchBidirectionalStreamConnectionByteTransceiverImpl extends AbstractPrefetchInputStreamByteReceiver implements BidirectionalStreamConnectionByteTransceiver
The Class PrefetchBidirectionalStreamConnectionByteTransceiverImpl.- Author:
- steiner
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.refcodes.io.AbstractByteReceiver
AbstractByteReceiver.ConnectableAutomaton
-
Nested classes/interfaces inherited from interface org.refcodes.component.BidirectionalConnectionComponent
org.refcodes.component.BidirectionalConnectionComponent.BidirectionalConnectionAutomaton<INPUT extends java.lang.Object,OUTPUT extends java.lang.Object>
-
Nested classes/interfaces inherited from interface org.refcodes.component.BidirectionalConnectionOpenable
org.refcodes.component.BidirectionalConnectionOpenable.BidirectionalConnectionOpenAutomaton<INPUT extends java.lang.Object,OUTPUT extends java.lang.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
-
-
Field Summary
-
Fields inherited from class org.refcodes.io.AbstractByteProvider
_datagramQueue, DATAGRAM_QUEUE_SIZE
-
Fields inherited from class org.refcodes.io.AbstractByteReceiver
_automaton
-
-
Constructor Summary
Constructors Constructor Description PrefetchBidirectionalStreamConnectionByteTransceiverImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
flush()
boolean
isOpenable(java.io.InputStream aInputStream, java.io.OutputStream aOutputStream)
void
open(java.io.InputStream aInputStream, java.io.OutputStream aOutputStream)
protected void
open(java.io.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.io.AbstractByteProvider
pushDatagram, pushDatagrams, pushDatagrams
-
Methods inherited from class org.refcodes.io.AbstractByteReceiver
getConnectionStatus, hasDatagram, isClosable, isClosed, isOpenable, isOpened, open, readDatagram, readDatagrams, readDatagrams, releaseAll, setConnectionStatus
-
Methods inherited from class org.refcodes.io.AbstractPrefetchInputStreamByteReceiver
isOpenable, open
-
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 interface org.refcodes.mixin.Loggable
alert, alert, critical, critical, debug, error, info, notice, panic, trace, warn, warn
-
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(java.io.InputStream aInputStream, java.io.OutputStream aOutputStream)
- Specified by:
isOpenable
in interfaceorg.refcodes.component.BidirectionalConnectionOpenable.BidirectionalConnectionOpenAutomaton<java.io.InputStream,java.io.OutputStream>
-
open
public void open(java.io.InputStream aInputStream, java.io.OutputStream aOutputStream) throws org.refcodes.component.OpenException
- Specified by:
open
in interfaceorg.refcodes.component.BidirectionalConnectionOpenable<java.io.InputStream,java.io.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 interfacejava.io.Flushable
- 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 classAbstractPrefetchInputStreamByteReceiver
- Throws:
org.refcodes.component.CloseException
-
open
protected void open(java.io.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 thePrefetchInputStreamConnectionReceiverImpl
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
-
-