Class BaseEncoder
java.lang.Object
org.refcodes.component.AbstractConnectable
org.refcodes.component.AbstractConnectableAutomaton
org.refcodes.codec.BaseEncoder
- All Implemented Interfaces:
Flushable, BaseMetricsAccessor, BaseMetricsAccessor.BaseMetricsBuilder<BaseEncoder>, BaseMetricsAccessor.BaseMetricsMutator, BaseMetricsAccessor.BaseMetricsProperty, Encoder, Closable, Closable.CloseAutomaton, ClosedAccessor, ConnectableComponent, ConnectableComponent.ConnectableAutomaton, ConnectionStatusAccessor, Flushable, OpenedAccessor, ByteSource, BytesSource, BytesTransmitter, ByteTransmitter, Transmittable, OutputStreamAccessor
- Direct Known Subclasses:
BaseEncoder.BaseEncoderConnection
public class BaseEncoder
extends AbstractConnectableAutomaton
implements BaseMetricsAccessor.BaseMetricsProperty, BaseMetricsAccessor.BaseMetricsBuilder<BaseEncoder>, Encoder
The BaseEncoder implements the BaseBuilder functionality in
terms of a BytesTransmitter.
Make sure to call close() when done as the final padding bytes are
appended to the end!
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classTheBaseEncoder.BaseEncoderConnectionimplements theBaseEncoderfunctionality in terms of aConnectionComponent.Nested classes/interfaces inherited from interface BaseMetricsAccessor
BaseMetricsAccessor.BaseMetricsBuilder<B>, BaseMetricsAccessor.BaseMetricsMutator, BaseMetricsAccessor.BaseMetricsPropertyNested classes/interfaces inherited from interface BytesTransmitter
BytesTransmitter.TransmitterOutputStreamNested classes/interfaces inherited from interface Closable
Closable.CloseAutomaton, Closable.CloseBuilder<B>Nested classes/interfaces inherited from interface ClosedAccessor
ClosedAccessor.ClosedMutator, ClosedAccessor.ClosedPropertyNested classes/interfaces inherited from interface ConnectableComponent
ConnectableComponent.ConnectableAutomatonNested classes/interfaces inherited from interface ConnectionStatusAccessor
ConnectionStatusAccessor.ConnectionStatusMutator, ConnectionStatusAccessor.ConnectionStatusPropertyNested classes/interfaces inherited from interface Flushable
Flushable.FlushBuilder<B>Nested classes/interfaces inherited from interface OpenedAccessor
OpenedAccessor.OpenedMutator, OpenedAccessor.OpenedPropertyNested classes/interfaces inherited from interface OutputStreamAccessor
OutputStreamAccessor.OutputStreamBuilder<B>, OutputStreamAccessor.OutputStreamMutator, OutputStreamAccessor.OutputStreamProperty -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedExplicit default constructor.BaseEncoder(OutputStream aOutputStream) Constructs theBaseEncoderinstance using the providedOutputStreamto receive the encoded data.BaseEncoder(OutputStream aOutputStream, BaseMetrics aBaseMetrics) Constructs theBaseEncoderinstance using the providedOutputStreamto receive the encoded data.BaseEncoder(BytesSource aByteConsumer) Constructs theBaseEncoderinstance using the providedBytesSourceto receive the encoded data.BaseEncoder(BytesTransmitter aByteSender) Constructs theBaseEncoderinstance using the providedBytesTransmitterto receive the encoded data.BaseEncoder(OutputStreamBytesTransmitter aOutputStreamBytesTransmitter, BaseMetrics aBaseMetrics) Constructs theBaseEncoderinstance using the providedOutputStreamBytesTransmitterto receive the encoded data. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidflush()Retrieves the base codec metrics from the base codec metrics property.protected voidopen(BytesSource aConnection) Open.voidsetBaseMetrics(BaseMetrics aBaseMetrics) Sets the base codec metrics for the base codec metrics property.voidtransmitByte(byte aByte) voidtransmitBytes(byte[] aDatagram) voidtransmitBytes(byte[] aDatagram, int aOffset, int aLength) withBaseMetrics(BaseMetrics aBaseMetrics) Sets the base codec metrics for the base codec metrics property.Methods inherited from class AbstractConnectableAutomaton
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatusMethods inherited from class AbstractConnectable
isThrownAsOfAlreadyClosedMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BaseMetricsAccessor.BaseMetricsProperty
letBaseMetricsMethods inherited from interface BytesTransmitter
getOutputStreamMethods inherited from interface Closable
closeIn, closeQuietly, closeUncheckedMethods inherited from interface Closable.CloseAutomaton
isClosableMethods inherited from interface ClosedAccessor
isClosedMethods inherited from interface ConnectionStatusAccessor
getConnectionStatus, isOpenedMethods inherited from interface Flushable
flushUnchecked, isFlushable
-
Constructor Details
-
BaseEncoder
Constructs theBaseEncoderinstance using the providedOutputStreamto receive the encoded data.- Parameters:
aOutputStream- the output stream- Throws:
IOException- throw in case using theOutputStreamcaused I/O related problems.
-
BaseEncoder
Constructs theBaseEncoderinstance using the providedOutputStreamto receive the encoded data.- Parameters:
aOutputStream- the output streamaBaseMetrics- TheBaseMetricsto use.- Throws:
IOException- throw in case using theOutputStreamcaused I/O related problems.
-
BaseEncoder
Constructs theBaseEncoderinstance using the providedBytesSourceto receive the encoded data.- Parameters:
aByteConsumer- TheBytesSourceto be fed with the encoded data.
-
BaseEncoder
Constructs theBaseEncoderinstance using the providedBytesTransmitterto receive the encoded data.- Parameters:
aByteSender- TheBytesTransmitterto be fed with the encoded data.- Throws:
IOException- in case opening or accessing an open line (connection, junction, link) caused problems.
-
BaseEncoder
public BaseEncoder(OutputStreamBytesTransmitter aOutputStreamBytesTransmitter, BaseMetrics aBaseMetrics) throws IOException Constructs theBaseEncoderinstance using the providedOutputStreamBytesTransmitterto receive the encoded data.- Parameters:
aOutputStreamBytesTransmitter- TheOutputStreamBytesTransmitterto use.aBaseMetrics- TheBaseMetricsto use.- Throws:
IOException- in case opening or accessing an open line (connection, junction, link) caused problems.
-
BaseEncoder
protected BaseEncoder()Explicit default constructor.
-
-
Method Details
-
getBaseMetrics
Retrieves the base codec metrics from the base codec metrics property.- Specified by:
getBaseMetricsin interfaceBaseMetricsAccessor- Returns:
- The base codec metrics stored by the base codec metrics property.
-
setBaseMetrics
Sets the base codec metrics for the base codec metrics property.- Specified by:
setBaseMetricsin interfaceBaseMetricsAccessor.BaseMetricsMutator- Parameters:
aBaseMetrics- The base codec metrics to be stored by the font style property.
-
withBaseMetrics
Sets the base codec metrics for the base codec metrics property.- Specified by:
withBaseMetricsin interfaceBaseMetricsAccessor.BaseMetricsBuilder<BaseEncoder>- Parameters:
aBaseMetrics- The base codec metrics to be stored by the font style property.- Returns:
- The builder for applying multiple build operations.
-
transmitByte
- Specified by:
transmitBytein interfaceByteSource- Specified by:
transmitBytein interfaceBytesSource- Throws:
IOException
-
transmitBytes
- Specified by:
transmitBytesin interfaceBytesSource- Throws:
IOException
-
transmitBytes
- Specified by:
transmitBytesin interfaceBytesSource- Specified by:
transmitBytesin interfaceBytesTransmitter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceByteTransmitter- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceFlushable- Throws:
IOException
-
close
Make sure to call
close()when done as the final padding bytes are appended to the end!- Specified by:
closein interfaceClosable- Overrides:
closein classAbstractConnectableAutomaton- Throws:
IOException
-
open
Open.- Parameters:
aConnection- the connection- Throws:
IOException- the open exception
-