Class Base64

java.lang.Object
org.apache.ws.security.util.Base64

public class Base64 extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    Field BASE64DEFAULTLENGTH
  • Method Summary

    Modifier and Type
    Method
    Description
    static byte[]
    decode(String encoded)
    Decodes Base64 data into octects
    static String
    encode(byte[] binaryData)
    Encode a byte array and fold lines at the standard 76th character.
    static String
    encode(byte[] binaryData, int length, boolean wrap)
    Encode a byte array in Base64 format and return an optionally wrapped line.
    protected static boolean
    isPad(byte octect)
     
    protected static boolean
    isWhiteSpace(byte octect)
     
    static void
    main(String[] args)
     
    protected static int
    removeWhiteSpace(byte[] data)
    remove WhiteSpace from MIME containing encoded Base64 data.

    Methods inherited from class java.lang.Object

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

    • BASE64DEFAULTLENGTH

      public static final int BASE64DEFAULTLENGTH
      Field BASE64DEFAULTLENGTH
      See Also:
  • Method Details

    • encode

      public static String encode(byte[] binaryData)
      Encode a byte array and fold lines at the standard 76th character.
      Parameters:
      binaryData - byte[] to be base64 encoded
      Returns:
      the String with encoded data
    • isWhiteSpace

      protected static boolean isWhiteSpace(byte octect)
    • isPad

      protected static boolean isPad(byte octect)
    • encode

      public static String encode(byte[] binaryData, int length, boolean wrap)
      Encode a byte array in Base64 format and return an optionally wrapped line.
      Parameters:
      binaryData - byte[] data to be encoded
      length - int length of wrapped lines; No wrapping if less than 4.
      Returns:
      a String with encoded data
    • decode

      public static byte[] decode(String encoded) throws WSSecurityException
      Decodes Base64 data into octects
      Parameters:
      encoded - String containing Base64 data
      Returns:
      Array containing decoded data.
      Throws:
      WSSecurityException
    • removeWhiteSpace

      protected static int removeWhiteSpace(byte[] data)
      remove WhiteSpace from MIME containing encoded Base64 data.
      Parameters:
      data - the byte array of base64 data (with WS)
      Returns:
      the new length
    • main

      public static void main(String[] args)
      Parameters:
      args -