BaseMetricsAccessor
, BaseMetricsAccessor.BaseCodecMetricsProperty
, BaseMetricsAccessor.BaseMetricsBuilder<BaseBuilder>
, BaseMetricsAccessor.BaseMetricsMutator
public class BaseBuilder extends Object implements BaseMetricsAccessor.BaseCodecMetricsProperty, BaseMetricsAccessor.BaseMetricsBuilder<BaseBuilder>
BaseBuilder
provides the functionality to do base encoding and
decoding such as done by the Base64 encoding and decoding functionality (see
"https://en.wikipedia.org/wiki/Base64"). The BaseBuilder
makes use of
the utility-Builder-Pattern and is designed to support codes starting with
Base2 till Base64 and further up.BaseMetricsAccessor.BaseCodecMetricsProperty, BaseMetricsAccessor.BaseMetricsBuilder<B extends BaseMetricsAccessor.BaseMetricsBuilder<B>>, BaseMetricsAccessor.BaseMetricsMutator
Constructor | Description |
---|---|
BaseBuilder() |
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.
|
String |
getEncodedText() |
Retrieves the encoded text from the encoded text property.
|
void |
setBaseMetrics(int aNumberBase) |
Sets the number base for the number base 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 |
setDecodedData(String aDecodedData) |
Sets the decoded data for the decoded data property.
|
void |
setDecodedData(String aDecodedData,
String aCharset) |
Sets the decoded data for the decoded data property.
|
void |
setDecodedData(String aDecodedData,
Charset aCharset) |
Sets the decoded data for the decoded data property.
|
void |
setEncodedText(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(String aEncodedText) |
Retrieves the decoded data calculated from the provided encoded text.
|
protected static byte[] |
toDecodedData(String aEncodedText,
BaseMetrics aBaseMetrics) |
To decoded data.
|
protected static int |
toDecodedSize(String aEncodedText,
BaseMetrics aBaseMetrics) |
To decoded size.
|
String |
toEncodedText(byte[] aDecodedData) |
Retrieves the encoded text calculated from the decoded data.
|
protected static String |
toEncodedText(byte[] aDecodedData,
BaseMetrics aBaseMetrics) |
To encoded text.
|
String |
toEncodedText(long aDecodedData) |
Retrieves the encoded text calculated from the decoded data.
|
String |
toEncodedText(String aDecodedData) |
Retrieves the encoded text calculated from the decoded data.
|
String |
toEncodedText(String aDecodedData,
String aCharset) |
Retrieves the encoded text calculated from the decoded data.
|
String |
toEncodedText(String aDecodedData,
Charset aCharset) |
Retrieves the encoded text calculated from the decoded data.
|
BaseBuilder |
withBaseMetrics(int aNumberBase) |
Sets the number base for the number base property.
|
BaseBuilder |
withBaseMetrics(BaseMetrics aBaseMetricsCodec) |
Sets the base codec metrics for the base codec metrics property.
|
BaseBuilder |
withDecodedData(byte[] aDecodedData) |
Sets the decoded data for the decoded data property.
|
BaseBuilder |
withDecodedData(long aDecodedData) |
Sets the decoded data for the decoded data property.
|
BaseBuilder |
withDecodedData(String aDecodedData) |
Sets the decoded data for the decoded data property.
|
BaseBuilder |
withDecodedData(String aDecodedData,
String aCharset) |
Sets the decoded data for the decoded data property.
|
BaseBuilder |
withDecodedData(String aDecodedData,
Charset aCharset) |
Sets the decoded data for the decoded data property.
|
BaseBuilder |
withEncodedText(String aEncodedText) |
Sets the encoded text for the encoded text property.
|
letBaseMetrics
public BaseBuilder withBaseMetrics(BaseMetrics aBaseMetricsCodec)
withBaseMetrics
in interface BaseMetricsAccessor.BaseMetricsBuilder<BaseBuilder>
aBaseMetricsCodec
- The base codec metrics to be stored by the font
style property.public void setBaseMetrics(int aNumberBase)
aNumberBase
- The number base to be stored by the base codec metrics
property.public BaseBuilder withBaseMetrics(int aNumberBase)
aNumberBase
- The number base to be stored by the base codec metrics
property.public String toEncodedText(String aDecodedData)
BaseMetrics
via 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 of
withDecodedData(byte[])
with getEncodedText()
aDecodedData
- The decoded data to be encoded.public String toEncodedText(String aDecodedData, Charset aCharset)
BaseMetrics
via 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 of
withDecodedData(byte[])
with getEncodedText()
aDecodedData
- The decoded data to be encoded.aCharset
- The charset to use when interpreting the decoded data
string.public String toEncodedText(String aDecodedData, String aCharset) throws UnsupportedEncodingException
BaseMetrics
via 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 of
withDecodedData(byte[])
with getEncodedText()
aDecodedData
- The decoded data to be encoded.aCharset
- The charset to use when interpreting the decoded data
string.UnsupportedEncodingException
- thrown in case the provided charset
name is not supported.public void setDecodedData(String aDecodedData)
aDecodedData
- The decoded data to be stored by the decoded data
property.public void setDecodedData(String aDecodedData, Charset aCharset)
aDecodedData
- The decoded data to be stored by the decoded data
property.aCharset
- The charset to use when interpreting the decoded data
string.public void setDecodedData(String aDecodedData, String aCharset) throws UnsupportedEncodingException
aDecodedData
- The decoded data to be stored by the decoded data
property.aCharset
- The charset to use when interpreting the decoded data
string.UnsupportedEncodingException
- thrown in case the provided charset
name is not supported.public BaseBuilder withDecodedData(byte[] aDecodedData)
aDecodedData
- The decoded data to be stored by the decoded data
property.public BaseBuilder withDecodedData(String aDecodedData)
aDecodedData
- The decoded data to be stored by the decoded data
property.public BaseBuilder withDecodedData(String aDecodedData, Charset aCharset)
aDecodedData
- The decoded data to be stored by the decoded data
property.aCharset
- The charset to use when interpreting the decoded data
string.public BaseBuilder withDecodedData(String aDecodedData, String aCharset) throws UnsupportedEncodingException
aDecodedData
- The decoded data to be stored by the decoded data
property.aCharset
- The charset to use when interpreting the decoded data
string.UnsupportedEncodingException
- thrown in case the provided charset
name is not supported.public BaseBuilder withDecodedData(long aDecodedData)
aDecodedData
- The decoded data to be stored by the decoded data
property.public BaseMetrics getBaseMetrics()
getBaseMetrics
in interface BaseMetricsAccessor
public void setBaseMetrics(BaseMetrics aBaseMetrics)
setBaseMetrics
in interface BaseMetricsAccessor.BaseMetricsMutator
aBaseMetrics
- The base codec metrics to be stored by the font
style property.public String getEncodedText()
public void setEncodedText(String aEncodedText)
aEncodedText
- The encoded text to be stored by the encoded text
property.public BaseBuilder withEncodedText(String aEncodedText)
aEncodedText
- The encoded text to be stored by the encoded text
property.public byte[] getDecodedData()
public void setDecodedData(byte[] aDecodedData)
aDecodedData
- The decoded data to be stored by the decoded data
property.public void setDecodedData(long aDecodedData)
aDecodedData
- The decoded data to be stored by the decoded data
property.public String toEncodedText(byte[] aDecodedData)
BaseMetrics
via 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 of
withDecodedData(byte[])
with getEncodedText()
aDecodedData
- The decoded data to be encoded.public byte[] toDecodedData(String aEncodedText)
BaseMetrics
via 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 of withEncodedText(String)
with
getDecodedData()
.aEncodedText
- The encoded text to be decoded.public String toEncodedText(long aDecodedData)
BaseMetrics
via 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 of
withDecodedData(byte[])
with getEncodedText()
aDecodedData
- The decoded data to be encoded.protected static String toEncodedText(byte[] aDecodedData, BaseMetrics aBaseMetrics)
aDecodedData
- the decoded dataaBaseMetrics
- the base metricsprotected static byte[] toDecodedData(String aEncodedText, BaseMetrics aBaseMetrics)
aEncodedText
- the encoded textaBaseMetrics
- the base metricsprotected static int toDecodedSize(String aEncodedText, BaseMetrics aBaseMetrics)
aEncodedText
- the encoded textaBaseMetrics
- the base metricsprotected static int toBytes(byte[] aDecodedBytes, int aOffset, int aWord, int aTrailingBytes, BaseMetrics aBaseMetrics)
aDecodedBytes
- the decoded bytesaOffset
- the offsetaWord
- the wordaTrailingBytes
- the trailing bytesaBaseMetrics
- the base metricsCopyright © 2021. All rights reserved.