Class Base64

java.lang.Object
org.glassfish.jersey.internal.util.Base64

public class Base64 extends Object
Utility class that implements base64 encoding and decoding.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final byte[]
     
    private static final byte[]
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    decode(byte[] buffer)
    Decodes Base64 data into octects.
    static String
    decodeAsString(byte[] buffer)
    Decodes array of bytes using base64 decoding and returns the result as a string.
    static String
    Decodes a string using base64 and returns the result as another string.
    static byte[]
    encode(byte[] buffer)
    Encodes array of bytes using base64 encoding.
    static String
    encodeAsString(byte[] buffer)
    Encodes array of bytes using base64 encoding and returns the result as a string.
    static String
    Encodes a string using base64 and returns the result as another string.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CHAR_SET

      private static final byte[] CHAR_SET
    • BASE64INDEXES

      private static final byte[] BASE64INDEXES
  • Constructor Details

    • Base64

      public Base64()
  • Method Details

    • encode

      public static byte[] encode(byte[] buffer)
      Encodes array of bytes using base64 encoding.
      Parameters:
      buffer - Array of bytes to be encoded.
      Returns:
      Encoded result as an array of bytes.
    • decode

      public static byte[] decode(byte[] buffer)
      Decodes Base64 data into octects.
      Parameters:
      buffer - Byte array containing Base64 data
      Returns:
      Array containing decoded data.
    • encodeAsString

      public static String encodeAsString(byte[] buffer)
      Encodes array of bytes using base64 encoding and returns the result as a string.
      Parameters:
      buffer - Array of bytes to be encoded.
      Returns:
      Resulting encoded string.
    • encodeAsString

      public static String encodeAsString(String text)
      Encodes a string using base64 and returns the result as another string.
      Parameters:
      text - String to be encoded.
      Returns:
      Resulting encoded string.
    • decodeAsString

      public static String decodeAsString(byte[] buffer)
      Decodes array of bytes using base64 decoding and returns the result as a string.
      Parameters:
      buffer - Array of bytes to be decoded.
      Returns:
      Resulting decoded string.
    • decodeAsString

      public static String decodeAsString(String text)
      Decodes a string using base64 and returns the result as another string.
      Parameters:
      text - String to be decoded.
      Returns:
      Resulting decoded string.