- java.lang.Object
 - 
- io.helidon.common.Base64Value
 
 
- 
public class Base64Value extends Object
Base64 wrapper. APIs use base64 encoding to transfer binary data as strings. This class provides helpful methods to handle such transitions.- See Also:
 create(byte[]),createFromEncoded(String),toBase64(),toBytes()
 
- 
- 
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Base64Valuecreate(byte[] bytes)Create a base64 value from bytes.static Base64Valuecreate(String plainText)Create a base64 value from plain text.static Base64ValuecreateFromEncoded(String base64Text)Create from an already encoded base64 value.StringtoBase64()Base64 encoded string.byte[]toBytes()Decoded value as bytes.StringtoDecodedString()Returns decoded bytes as a string.StringtoString() 
 - 
 
- 
- 
Method Detail
- 
create
public static Base64Value create(String plainText)
Create a base64 value from plain text. This method uses UTF-8 bytes of the string to create a base64 encoded string.- Parameters:
 plainText- plain text to use- Returns:
 - a new value
 
 
- 
create
public static Base64Value create(byte[] bytes)
Create a base64 value from bytes. The bytes are encoded using base64.- Parameters:
 bytes- bytes to use- Returns:
 - a new value
 
 
- 
createFromEncoded
public static Base64Value createFromEncoded(String base64Text)
Create from an already encoded base64 value.- Parameters:
 base64Text- base64 to use (no encoding will be done)- Returns:
 - a new value
 
 
- 
toBase64
public String toBase64()
Base64 encoded string.- Returns:
 - base64 value
 
 
- 
toBytes
public byte[] toBytes()
Decoded value as bytes.- Returns:
 - bytes
 
 
- 
toDecodedString
public String toDecodedString()
Returns decoded bytes as a string.WARNING - this method is potentially dangerous, as it uses the underlying bytes to create a new string without any validation whether it is in fact bytes fit for a readable string. Use only when the data is known to be a string.
- Returns:
 - string value from the decoded bytes
 
 
 - 
 
 -