public class ByteSenderDecorator extends AbstractByteSender implements ByteSender
ByteSenderDecorator
decorates a ByteConsumer
with the
additional methods of a ByteSender
making it easy to use a
ByteConsumer
wherever a ByteSender
is expected.org.refcodes.component.ConnectableComponent.ConnectableAutomaton
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
Constructor and Description |
---|
ByteSenderDecorator(ByteConsumer aByteConsumer) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
flush() |
void |
writeDatagram(byte aDatagram)
Writes (sends) a byte.
|
void |
writeDatagrams(byte[] aDatagrams)
Writes (sends) a byte block.
|
void |
writeDatagrams(byte[] aDatagrams,
int aOffset,
int aLength)
Writes (sends) a byte block.
|
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
public ByteSenderDecorator(ByteConsumer aByteConsumer)
public void writeDatagram(byte aDatagram) throws org.refcodes.component.OpenException
ByteDatagramConsumer
writeDatagram
in interface ByteConsumer
writeDatagram
in interface ByteDatagramConsumer
aDatagram
- The byte to be pushed.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void writeDatagrams(byte[] aDatagrams) throws org.refcodes.component.OpenException
ByteBlockConsumer
writeDatagrams
in interface ByteBlockConsumer
writeDatagrams
in interface ByteConsumer
aDatagrams
- The byte to be pushed.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void writeDatagrams(byte[] aDatagrams, int aOffset, int aLength) throws org.refcodes.component.OpenException
ByteBlockConsumer
writeDatagrams
in interface ByteBlockConsumer
writeDatagrams
in interface ByteSender
writeDatagrams
in class AbstractByteSender
aDatagrams
- The byte to be pushed.aOffset
- The offset from which to take the data.aLength
- The number of elements to push starting at the given
offset.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void flush() throws org.refcodes.component.OpenException
flush
in interface Flushable
flush
in interface ByteSender
org.refcodes.component.OpenException
public void close() throws org.refcodes.component.CloseException
close
in interface org.refcodes.component.Closable
close
in class org.refcodes.component.impls.AbstractConnectableAutomaton
org.refcodes.component.CloseException
Copyright © 2017. All rights reserved.