Package 

Class HttpRequest.Base64


  • 
    public class HttpRequest.Base64
    
                        

    Encodes and decodes to and from Base64 notation.

    I am placing this code in the Public Domain. Do with it as you will. Thissoftware comes with no guarantees or warranties but with plenty ofwell-wishing instead! Please visit http://iharder.net/base64 periodicallyto check for updates or to contribute improvements.

    • Method Summary

      Modifier and Type Method Description
      static String encode(String string) Encode string as a byte array in Base64 annotation.
      static String encodeBytes(Array<byte> source) Encodes a byte array into Base64 notation.
      static String encodeBytes(Array<byte> source, int off, int len) Encodes a byte array into Base64 notation.
      static Array<byte> encodeBytesToBytes(Array<byte> source, int off, int len) Similar to encodeBytes but returns a bytearray instead of instantiating a String.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • encode

         static String encode(String string)

        Encode string as a byte array in Base64 annotation.

      • encodeBytes

         static String encodeBytes(Array<byte> source)

        Encodes a byte array into Base64 notation.

        Parameters:
        source - The data to convert
      • encodeBytes

         static String encodeBytes(Array<byte> source, int off, int len)

        Encodes a byte array into Base64 notation.

        Parameters:
        source - The data to convert
        off - Offset in array where conversion should begin
        len - Length of data to convert
      • encodeBytesToBytes

         static Array<byte> encodeBytesToBytes(Array<byte> source, int off, int len)

        Similar to encodeBytes but returns a bytearray instead of instantiating a String. This is more efficient if you'reworking with I/O streams and have large data sets to encode.

        Parameters:
        source - The data to convert
        off - Offset in array where conversion should begin
        len - Length of data to convert