Skip to content

@Base64

@Base64 decodes Base64 encoded instances of type byte[] or String into byte[] instances.

The annotation's encoding attribute configures the desired encoding scheme:

  • BASIC: for the Basic encoding scheme (default)
  • URL: for the URL and Filename Safe encoding scheme
  • MIME: for the MIME encoding scheme

The following source types and target declarations are supported.

Source Type Target Declaration Example
byte[] @Base64 byte[] new byte[] { 80, 122, 56, 47 }new byte[] { 63, 63, 63 }
byte[] @Base64(encoding = URL) byte[] new byte[] { 80, 122, 56, 95 }new byte[] { 63, 63, 63 }
byte[] @Base64(encoding = MIME) byte[] new byte[] { 80, 122, 13, 10, 56, 47 }new byte[] { 63, 63, 63 }
String @Base64 byte[] "Pz8/"new byte[] { 63, 63, 63 }
String @Base64(encoding = URL) byte[] "Pz8_"new byte[] { 63, 63, 63 }
String @Base64(encoding = MIME) byte[] "Pz\r\n8/"new byte[] { 63, 63, 63 }