Package org.codehaus.stax2.typed
Class Base64Variants
- java.lang.Object
-
- org.codehaus.stax2.typed.Base64Variants
-
public final class Base64Variants extends Object
This class is used as a container for commonly used Base64 variants.- Since:
- 3.0.0
- Author:
- Tatu Saloranta
-
-
Field Summary
Fields Modifier and Type Field Description static Base64VariantMIMEThis variant is what most people would think of "the standard" Base64 encoding.static Base64VariantMIME_NO_LINEFEEDSSlightly non-standard modification ofMIMEwhich does not use linefeeds (max line length set to infinite).static Base64VariantMODIFIED_FOR_URLThis non-standard variant is usually used when encoded data needs to be passed via URLs (such as part of GET request).static Base64VariantPEMThis variant is the one that predatesMIME: it is otherwise identical, except that it mandates shorter line length.
-
Constructor Summary
Constructors Constructor Description Base64Variants()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Base64VariantgetDefaultVariant()Method used to get the default variant ("MIME") for cases where caller does not explicitly specify the variant
-
-
-
Field Detail
-
MIME
public static final Base64Variant MIME
This variant is what most people would think of "the standard" Base64 encoding.See wikipedia Base64 entry for details.
-
MIME_NO_LINEFEEDS
public static final Base64Variant MIME_NO_LINEFEEDS
Slightly non-standard modification ofMIMEwhich does not use linefeeds (max line length set to infinite). Useful when linefeeds wouldn't work well (possibly in attributes), or for minor space savings (save 1 linefeed per 76 data chars, ie. ~1.4% savings).
-
PEM
public static final Base64Variant PEM
This variant is the one that predatesMIME: it is otherwise identical, except that it mandates shorter line length.
-
MODIFIED_FOR_URL
public static final Base64Variant MODIFIED_FOR_URL
This non-standard variant is usually used when encoded data needs to be passed via URLs (such as part of GET request). It differs from the baseMIMEvariant in multiple ways. First, no padding is used: this also means that it generally can not be written in multiple separate but adjacent chunks (which would not be the usual use case in any case). Also, no linefeeds are used (max line length set to infinite). And finally, two characters (plus and slash) that would need quoting in URLs are replaced with more optimal alternatives (hyphen and underscore, respectively).
-
-
Method Detail
-
getDefaultVariant
public static Base64Variant getDefaultVariant()
Method used to get the default variant ("MIME") for cases where caller does not explicitly specify the variant
-
-