Package org.refcodes.codec
Class BaseBuilderImpl
- java.lang.Object
-
- org.refcodes.codec.BaseBuilderImpl
-
- All Implemented Interfaces:
BaseBuilder
,BaseMetricsAccessor
,BaseMetricsAccessor.BaseCodecMetricsProperty
,BaseMetricsAccessor.BaseMetricsBuilder<BaseBuilder>
,BaseMetricsAccessor.BaseMetricsMutator
public class BaseBuilderImpl extends java.lang.Object implements BaseBuilder
Vanilla plain implementation of theBaseBuilder
interface.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.refcodes.codec.BaseMetricsAccessor
BaseMetricsAccessor.BaseCodecMetricsProperty, BaseMetricsAccessor.BaseMetricsBuilder<B extends BaseMetricsAccessor.BaseMetricsBuilder<B>>, BaseMetricsAccessor.BaseMetricsMutator
-
-
Constructor Summary
Constructors Constructor Description BaseBuilderImpl()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BaseMetrics
getBaseMetrics()
Retrieves the base codec metrics from the base codec metrics property.byte[]
getDecodedData()
Retrieves the decoded data from the decoded data property.java.lang.String
getEncodedText()
Retrieves the encoded text from the encoded text property.void
setBaseMetrics(BaseMetrics aBaseMetrics)
Sets the base codec metrics for the base codec metrics property.void
setDecodedData(byte[] aDecodedData)
Sets the decoded data for the decoded data property.void
setDecodedData(long aDecodedData)
Sets the decoded data for the decoded data property.void
setEncodedText(java.lang.String aEncodedText)
Sets the encoded text for the encoded text property.protected static int
toBytes(byte[] aDecodedBytes, int aOffset, int aWord, int aTrailingBytes, BaseMetrics aBaseMetrics)
To bytes.byte[]
toDecodedData(java.lang.String aEncodedText)
Retrieves the decoded data calculated from the provided encoded text.protected static byte[]
toDecodedData(java.lang.String aEncodedText, BaseMetrics aBaseMetrics)
To decoded data.protected static int
toDecodedSize(java.lang.String aEncodedText, BaseMetrics aBaseMetrics)
To decoded size.java.lang.String
toEncodedText(byte[] aDecodedData)
Retrieves the encoded text calculated from the decoded data.protected static java.lang.String
toEncodedText(byte[] aDecodedData, BaseMetrics aBaseMetrics)
To encoded text.java.lang.String
toEncodedText(long aDecodedData)
Retrieves the encoded text calculated from the decoded data.-
Methods inherited from interface org.refcodes.codec.BaseBuilder
setBaseMetrics, withBaseMetrics, withBaseMetrics, withDecodedData, withDecodedData, withEncodedText
-
-
-
-
Method Detail
-
getBaseMetrics
public BaseMetrics getBaseMetrics()
Retrieves the base codec metrics from the base codec metrics property.- Specified by:
getBaseMetrics
in interfaceBaseMetricsAccessor
- Returns:
- The base codec metrics stored by the base codec metrics property.
-
setBaseMetrics
public void setBaseMetrics(BaseMetrics aBaseMetrics)
Sets the base codec metrics for the base codec metrics property.- Specified by:
setBaseMetrics
in interfaceBaseMetricsAccessor.BaseMetricsMutator
- Parameters:
aBaseMetrics
- The base codec metrics to be stored by the font style property.
-
getEncodedText
public java.lang.String getEncodedText()
Retrieves the encoded text from the encoded text property.- Specified by:
getEncodedText
in interfaceBaseBuilder
- Returns:
- The encoded text stored by the encoded text property.
-
setEncodedText
public void setEncodedText(java.lang.String aEncodedText)
Sets the encoded text for the encoded text property.- Specified by:
setEncodedText
in interfaceBaseBuilder
- Parameters:
aEncodedText
- The encoded text to be stored by the encoded text property.
-
getDecodedData
public byte[] getDecodedData()
Retrieves the decoded data from the decoded data property.- Specified by:
getDecodedData
in interfaceBaseBuilder
- Returns:
- The decoded data stored by the decoded data property.
-
setDecodedData
public void setDecodedData(byte[] aDecodedData)
Sets the decoded data for the decoded data property.- Specified by:
setDecodedData
in interfaceBaseBuilder
- Parameters:
aDecodedData
- The decoded data to be stored by the decoded data property.
-
setDecodedData
public void setDecodedData(long aDecodedData)
Sets the decoded data for the decoded data property.- Specified by:
setDecodedData
in interfaceBaseBuilder
- Parameters:
aDecodedData
- The decoded data to be stored by the decoded data property.
-
toEncodedText
public java.lang.String toEncodedText(byte[] aDecodedData)
Retrieves the encoded text calculated from the decoded data. This method is to be side effect free in terms of the decoded data (and the encoded result) is not part of the state for this instance (from the point of view of this method). Still changing for example theBaseMetrics
viaBaseBuilder.withBaseMetrics(BaseMetrics)
can cause side effects! For avoiding thread race conditions / side effects regarding the decoded data (and the encoded result), use this method instead of the combination ofBaseBuilder.withDecodedData(byte[])
withBaseBuilder.getEncodedText()
- Specified by:
toEncodedText
in interfaceBaseBuilder
- Parameters:
aDecodedData
- The decoded data to be encoded.- Returns:
- The encoded text calculated from the decoded data.
-
toDecodedData
public byte[] toDecodedData(java.lang.String aEncodedText)
Retrieves the decoded data calculated from the provided encoded text. This method is to be side effect free in terms of the encoded text (and the decoded result) is not part of the state for this instance (from the point of view of this method). Still changing for example theBaseMetrics
viaBaseBuilder.withBaseMetrics(BaseMetrics)
can cause side effects! For avoiding thread race conditions / side effects regarding the encoded text (and the decoded result), use this method instead of the combination ofBaseBuilder.withEncodedText(String)
withBaseBuilder.getDecodedData()
.- Specified by:
toDecodedData
in interfaceBaseBuilder
- Parameters:
aEncodedText
- The encoded text to be decoded.- Returns:
- The decoded data decoded from the encoded text.
-
toEncodedText
public java.lang.String toEncodedText(long aDecodedData)
Retrieves the encoded text calculated from the decoded data. This method is to be side effect free in terms of the decoded data (and the encoded result) is not part of the state for this instance (from the point of view of this method). Still changing for example theBaseMetrics
viaBaseBuilder.withBaseMetrics(BaseMetrics)
can cause side effects! For avoiding thread race conditions / side effects regarding the decoded data (and the encoded result), use this method instead of the combination ofBaseBuilder.withDecodedData(byte[])
withBaseBuilder.getEncodedText()
- Specified by:
toEncodedText
in interfaceBaseBuilder
- Parameters:
aDecodedData
- The decoded data to be encoded.- Returns:
- The encoded text calculated from the decoded data.
-
toEncodedText
protected static java.lang.String toEncodedText(byte[] aDecodedData, BaseMetrics aBaseMetrics)
To encoded text.- Parameters:
aDecodedData
- the decoded dataaBaseMetrics
- the base metrics- Returns:
- the string
-
toDecodedData
protected static byte[] toDecodedData(java.lang.String aEncodedText, BaseMetrics aBaseMetrics)
To decoded data.- Parameters:
aEncodedText
- the encoded textaBaseMetrics
- the base metrics- Returns:
- the byte[]
-
toDecodedSize
protected static int toDecodedSize(java.lang.String aEncodedText, BaseMetrics aBaseMetrics)
To decoded size.- Parameters:
aEncodedText
- the encoded textaBaseMetrics
- the base metrics- Returns:
- the int
-
toBytes
protected static int toBytes(byte[] aDecodedBytes, int aOffset, int aWord, int aTrailingBytes, BaseMetrics aBaseMetrics)
To bytes.- Parameters:
aDecodedBytes
- the decoded bytesaOffset
- the offsetaWord
- the wordaTrailingBytes
- the trailing bytesaBaseMetrics
- the base metrics- Returns:
- the int
-
-