Flushable
, 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
, ByteSource
, BytesSource
, BytesTransmitter
, ByteTransmitter
, Transmittable
, org.refcodes.mixin.OutputStreamAccessor
public class ByteTransmitterDecorator extends AbstractBytesTransmitter implements BytesTransmitter
ByteTransmitterDecorator
decorates a BytesSource
with the
additional methods of a BytesTransmitter
making it easy to use a
BytesSource
wherever a BytesTransmitter
is expected.BytesTransmitter.TransmitterOutputStream
org.refcodes.component.Closable.CloseAutomaton, org.refcodes.component.Closable.CloseBuilder<B extends org.refcodes.component.Closable.CloseBuilder<B>>
org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
org.refcodes.component.ConnectableComponent.ConnectableAutomaton
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusProperty
org.refcodes.component.Flushable.FlushBuilder<B extends org.refcodes.component.Flushable.FlushBuilder<B>>
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
org.refcodes.mixin.OutputStreamAccessor.OutputStreamBuilder<B extends org.refcodes.mixin.OutputStreamAccessor.OutputStreamBuilder<?>>, org.refcodes.mixin.OutputStreamAccessor.OutputStreamMutator, org.refcodes.mixin.OutputStreamAccessor.OutputStreamProperty
Constructor | Description |
---|---|
ByteTransmitterDecorator(BytesSource aByteConsumer) |
Instantiates a new byte sender decorator.
|
Modifier and Type | Method | Description |
---|---|---|
void |
close() |
|
void |
flush() |
|
void |
transmitAllBytes(byte[] aBytes) |
Writes (sends) a byte block.
|
void |
transmitByte(byte aByte) |
Writes (sends) a byte.
|
void |
transmitBytes(byte[] aBytes,
int aOffset,
int aLength) |
Writes (sends) a byte block.
|
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
getOutputStream
closeIn, closeQuietly, closeUnchecked
public ByteTransmitterDecorator(BytesSource aByteConsumer)
aByteConsumer
- the byte consumerpublic void transmitByte(byte aByte) throws IOException
transmitByte
in interface ByteSource
transmitByte
in interface BytesSource
aByte
- The byte to be pushed.IOException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void transmitAllBytes(byte[] aBytes) throws IOException
transmitAllBytes
in interface BytesSource
aBytes
- The byte to be pushed.IOException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void transmitBytes(byte[] aBytes, int aOffset, int aLength) throws IOException
transmitBytes
in interface BytesSource
transmitBytes
in interface BytesTransmitter
transmitBytes
in class AbstractBytesTransmitter
aBytes
- 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.IOException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public void flush() throws IOException
flush
in interface ByteTransmitter
flush
in interface Flushable
flush
in interface org.refcodes.component.Flushable
IOException
public void close() throws IOException
close
in interface org.refcodes.component.Closable
close
in class org.refcodes.component.AbstractConnectableAutomaton
IOException
Copyright © 2021. All rights reserved.