Class PrefetchBidirectionalStreamConnectionByteTransceiverImpl

    • Nested Class Summary

      • 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
      • Nested classes/interfaces inherited from interface org.refcodes.component.Flushable

        org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
      • Nested classes/interfaces inherited from interface org.refcodes.component.OpenedAccessor

        org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
    • Constructor Detail

      • PrefetchBidirectionalStreamConnectionByteTransceiverImpl

        public PrefetchBidirectionalStreamConnectionByteTransceiverImpl​()
    • Method Detail

      • isOpenable

        public boolean isOpenable​(java.io.InputStream aInputStream,
                                  java.io.OutputStream aOutputStream)
        Specified by:
        isOpenable in interface org.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 interface org.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 interface ByteConsumer
        Specified by:
        writeDatagram in interface ByteDatagramConsumer
        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 interface ByteSender
        Specified by:
        flush in interface java.io.Flushable
        Specified by:
        flush in interface org.refcodes.component.Flushable
        Throws:
        org.refcodes.component.OpenException
      • close

        public void close​()
                   throws org.refcodes.component.CloseException
        Specified by:
        close in interface org.refcodes.component.Closable
        Overrides:
        close in class AbstractPrefetchInputStreamByteReceiver
        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 flushed ObjectOutputStream (via ObjectOutputStream.flush()) encapsulating a PipedOutputStream which in turn encapsulates a PipedInputStream to this open(OutputStream) method. This enables you a non-blocking test of the OutputStreamConnectionSenderImpl connected with the PrefetchInputStreamConnectionReceiverImpl counterpart which is being opened with the PipedInputStream. ATTENTION: For maintainers, please keep the below code in sync with the code from OutputStreamConnectionSenderImpl.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