java.lang.Object
org.refcodes.component.AbstractConnectableAutomaton
org.refcodes.codec.BaseEncoder
- All Implemented Interfaces:
Flushable,BaseMetricsAccessor,BaseMetricsAccessor.BaseMetricsBuilder<BaseEncoder>,BaseMetricsAccessor.BaseMetricsMutator,BaseMetricsAccessor.BaseMetricsProperty,Encoder,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,org.refcodes.io.ByteSource,org.refcodes.io.BytesSource,org.refcodes.io.BytesTransmitter,org.refcodes.io.ByteTransmitter,org.refcodes.io.Transmittable,org.refcodes.mixin.OutputStreamAccessor
- Direct Known Subclasses:
BaseEncoder.BaseEncoderConnection
public class BaseEncoder
extends org.refcodes.component.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 org.refcodes.codec.BaseMetricsAccessor
BaseMetricsAccessor.BaseMetricsBuilder<B extends BaseMetricsAccessor.BaseMetricsBuilder<B>>, BaseMetricsAccessor.BaseMetricsMutator, BaseMetricsAccessor.BaseMetricsPropertyNested classes/interfaces inherited from interface org.refcodes.io.BytesTransmitter
org.refcodes.io.BytesTransmitter.TransmitterOutputStreamNested 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.ClosedPropertyNested classes/interfaces inherited from interface org.refcodes.component.ConnectableComponent
org.refcodes.component.ConnectableComponent.ConnectableAutomatonNested classes/interfaces inherited from interface org.refcodes.component.ConnectionStatusAccessor
org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusMutator, org.refcodes.component.ConnectionStatusAccessor.ConnectionStatusPropertyNested 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.OpenedPropertyNested classes/interfaces inherited from interface org.refcodes.mixin.OutputStreamAccessor
org.refcodes.mixin.OutputStreamAccessor.OutputStreamBuilder<B extends org.refcodes.mixin.OutputStreamAccessor.OutputStreamBuilder<?>>, org.refcodes.mixin.OutputStreamAccessor.OutputStreamMutator, org.refcodes.mixin.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(org.refcodes.io.BytesSource aByteConsumer) Constructs theBaseEncoderinstance using the providedBytesSourceto receive the encoded data.BaseEncoder(org.refcodes.io.BytesTransmitter aByteSender) Constructs theBaseEncoderinstance using the providedBytesTransmitterto receive the encoded data.BaseEncoder(org.refcodes.io.OutputStreamBytesTransmitter aOutputStreamBytesTransmitter, BaseMetrics aBaseMetrics) Constructs theBaseEncoderinstance using the providedOutputStreamBytesTransmitterto receive the encoded data. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Make sure to callclose()when done as the final padding bytes are appended to the end!voidflush()Retrieves the base codec metrics from the base codec metrics property.protected voidopen(org.refcodes.io.BytesSource aConnection) Open.voidsetBaseMetrics(BaseMetrics aBaseMetrics) Sets the base codec metrics for the base codec metrics property.voidtransmitAllBytes(byte[] aDatagram) voidtransmitByte(byte aByte) 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 org.refcodes.component.AbstractConnectableAutomaton
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.refcodes.codec.BaseMetricsAccessor.BaseMetricsProperty
letBaseMetricsMethods inherited from interface org.refcodes.io.BytesTransmitter
getOutputStreamMethods inherited from interface org.refcodes.component.Closable
closeIn, closeQuietly, closeUncheckedMethods inherited from interface org.refcodes.component.Closable.CloseAutomaton
isClosableMethods inherited from interface org.refcodes.component.ClosedAccessor
isClosedMethods inherited from interface org.refcodes.component.ConnectionStatusAccessor
getConnectionStatus, isOpenedMethods inherited from interface org.refcodes.component.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
public BaseEncoder(org.refcodes.io.BytesSource aByteConsumer) 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(org.refcodes.io.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 interfaceorg.refcodes.io.ByteSource- Specified by:
transmitBytein interfaceorg.refcodes.io.BytesSource- Throws:
IOException
-
transmitAllBytes
- Specified by:
transmitAllBytesin interfaceorg.refcodes.io.BytesSource- Throws:
IOException
-
transmitBytes
- Specified by:
transmitBytesin interfaceorg.refcodes.io.BytesSource- Specified by:
transmitBytesin interfaceorg.refcodes.io.BytesTransmitter- Throws:
IOException
-
flush
- Specified by:
flushin interfaceorg.refcodes.io.ByteTransmitter- Specified by:
flushin interfaceFlushable- Specified by:
flushin interfaceorg.refcodes.component.Flushable- Throws:
IOException
-
close
Make sure to callclose()when done as the final padding bytes are appended to the end!- Specified by:
closein interfaceorg.refcodes.component.Closable- Overrides:
closein classorg.refcodes.component.AbstractConnectableAutomaton- Throws:
IOException
-
open
Open.- Parameters:
aConnection- the connection- Throws:
IOException- the open exception
-