jfxtras.icalendarfx.parameters.Encoding Maven / Gradle / Ivy
package jfxtras.icalendarfx.parameters;
import java.util.HashMap;
import java.util.Map;
import jfxtras.icalendarfx.parameters.Encoding;
import jfxtras.icalendarfx.parameters.VParameterBase;
import jfxtras.icalendarfx.parameters.Encoding.EncodingType;
import jfxtras.icalendarfx.properties.component.descriptive.Attachment;
import jfxtras.icalendarfx.utilities.StringConverter;
/**
* ENCODING
* Inline Encoding
* RFC 5545, 3.2.7, page 18
*
* To specify an alternate inline encoding for the property value.
*
* Example:
* ATTACH;FMTTYPE=text/plain;ENCODING=BASE64;VALUE=BINARY:TG9yZW
* 0gaXBzdW0gZG9sb3Igc2l0IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2ljaW
* 5nIGVsaXQsIHNlZCBkbyBlaXVzbW9kIHRlbXBvciBpbmNpZGlkdW50IHV0IG
* xhYm9yZSBldCBkb2xvcmUgbWFnbmEgYWxpcXVhLiBVdCBlbmltIGFkIG1pbm
* ltIHZlbmlhbSwgcXVpcyBub3N0cnVkIGV4ZXJjaXRhdGlvbiB1bGxhbWNvIG
* xhYm9yaXMgbmlzaSB1dCBhbGlxdWlwIGV4IGVhIGNvbW1vZG8gY29uc2VxdW
* F0LiBEdWlzIGF1dGUgaXJ1cmUgZG9sb3IgaW4gcmVwcmVoZW5kZXJpdCBpbi
* B2b2x1cHRhdGUgdmVsaXQgZXNzZSBjaWxsdW0gZG9sb3JlIGV1IGZ1Z2lhdC
* BudWxsYSBwYXJpYXR1ci4gRXhjZXB0ZXVyIHNpbnQgb2NjYWVjYXQgY3VwaW
* RhdGF0IG5vbiBwcm9pZGVudCwgc3VudCBpbiBjdWxwYSBxdWkgb2ZmaWNpYS
* BkZXNlcnVudCBtb2xsaXQgYW5pbSBpZCBlc3QgbGFib3J1bS4=
*
* @author David Bal
* @see Attachment
*/
public class Encoding extends VParameterBase
{
private static final StringConverter CONVERTER = new StringConverter()
{
@Override
public String toString(EncodingType object)
{
return object.toString();
}
@Override
public EncodingType fromString(String string)
{
return EncodingType.enumFromName(string.toUpperCase());
}
};
public Encoding()
{
super(EncodingType.EIGHT_BIT, CONVERTER);
}
public Encoding(EncodingType value)
{
super(value, CONVERTER);
}
public Encoding(Encoding source)
{
super(source, CONVERTER);
}
public enum EncodingType
{
EIGHT_BIT ("8BIT"),
BASE64 ("BASE64");
private static Map enumFromNameMap = makeEnumFromNameMap();
private static Map makeEnumFromNameMap()
{
Map map = new HashMap<>();
EncodingType[] values = EncodingType.values();
for (int i=0; i
© 2015 - 2024 Weber Informatics LLC | Privacy Policy