# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Constants | Methods | Inherited Methods

# Base64

`public class Base64`
`extends Object` ``

java.lang.Object
↳ | android.util.Base64

Utilities for encoding and decoding the Base64 representation of binary data. See RFCs 2045 and 3548.

## Summary

### Constants
`int` | `CRLF` Encoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF.
`int` | `DEFAULT` Default values for encoder/decoder flags.
`int` | `NO_CLOSE` Flag to pass to `Base64OutputStream` to indicate that it should not close the output stream it is wrapping when it itself is closed.
`int` | `NO_PADDING` Encoder flag bit to omit the padding '=' characters at the end of the output (if any).
`int` | `NO_WRAP` Encoder flag bit to omit all line terminators (i.e., the output will be on one long line).
`int` | `URL_SAFE` Encoder/decoder flag bit to indicate using the "URL and filename safe" variant of Base64 (see RFC 3548 section 4) where `-` and `_` are used in place of `+` and `/`.

### Public methods
`static byte[]` | `decode(String str, int flags)` Decode the Base64-encoded data in input and return the data in a new byte array.
`static byte[]` | `decode(byte[] input, int flags)` Decode the Base64-encoded data in input and return the data in a new byte array.
`static byte[]` | `decode(byte[] input, int offset, int len, int flags)` Decode the Base64-encoded data in input and return the data in a new byte array.
`static byte[]` | `encode(byte[] input, int flags)` Base64-encode the given data and return a newly allocated byte[] with the result.
`static byte[]` | `encode(byte[] input, int offset, int len, int flags)` Base64-encode the given data and return a newly allocated byte[] with the result.
`static String` | `encodeToString(byte[] input, int offset, int len, int flags)` Base64-encode the given data and return a newly allocated String with the result.
`static String` | `encodeToString(byte[] input, int flags)` Base64-encode the given data and return a newly allocated String with the result.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Constants

### CRLF

    public static final int CRLF

Encoder flag bit to indicate lines should be terminated with a CRLF pair instead of just an LF. Has no effect if `NO_WRAP` is specified as well.

Constant Value: 4 (0x00000004)

### DEFAULT

    public static final int DEFAULT

Default values for encoder/decoder flags.

Constant Value: 0 (0x00000000)

### NO_CLOSE

    public static final int NO_CLOSE

Flag to pass to `Base64OutputStream` to indicate that it should not close the output stream it is wrapping when it itself is closed.

Constant Value: 16 (0x00000010)

### NO_PADDING

    public static final int NO_PADDING

Encoder flag bit to omit the padding '=' characters at the end of the output (if any).

Constant Value: 1 (0x00000001)

### NO_WRAP

    public static final int NO_WRAP

Encoder flag bit to omit all line terminators (i.e., the output will be on one long line).

Constant Value: 2 (0x00000002)

### URL_SAFE

    public static final int URL_SAFE

Encoder/decoder flag bit to indicate using the "URL and filename safe" variant of Base64 (see RFC 3548 section 4) where `-` and `_` are used in place of `+` and `/`.

Constant Value: 8 (0x00000008)

## Public methods

### decode

    public static byte[] decode (String str,
                    int flags)

Decode the Base64-encoded data in input and return the data in a new byte array.

The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.

Parameters
`str` | `String`: the input String to decode, which is converted to bytes using the default charset
`flags` | `int`: controls certain features of the decoded output. Pass `DEFAULT` to decode standard Base64.

Returns
`byte[]` |

Throws
`IllegalArgumentException` | if the input contains incorrect padding

### decode

    public static byte[] decode (byte[] input,
                    int flags)

Decode the Base64-encoded data in input and return the data in a new byte array.

The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.

Parameters
`input` | `byte`: the input array to decode
`flags` | `int`: controls certain features of the decoded output. Pass `DEFAULT` to decode standard Base64.

Returns
`byte[]` |

Throws
`IllegalArgumentException` | if the input contains incorrect padding

### decode

    public static byte[] decode (byte[] input,
                    int offset,
                    int len,
                    int flags)

Decode the Base64-encoded data in input and return the data in a new byte array.

The padding '=' characters at the end are considered optional, but if any are present, there must be the correct number of them.

Parameters
`input` | `byte`: the data to decode
`offset` | `int`: the position within the input array at which to start
`len` | `int`: the number of bytes of input to decode
`flags` | `int`: controls certain features of the decoded output. Pass `DEFAULT` to decode standard Base64.

Returns
`byte[]` |

Throws
`IllegalArgumentException` | if the input contains incorrect padding

### encode

    public static byte[] encode (byte[] input,
                    int flags)

Base64-encode the given data and return a newly allocated byte[] with the result.

Parameters
`input` | `byte`: the data to encode
`flags` | `int`: controls certain features of the encoded output. Passing `DEFAULT` results in output that adheres to RFC 2045.

Returns
`byte[]` |

### encode

    public static byte[] encode (byte[] input,
                    int offset,
                    int len,
                    int flags)

Base64-encode the given data and return a newly allocated byte[] with the result.

Parameters
`input` | `byte`: the data to encode
`offset` | `int`: the position within the input array at which to start
`len` | `int`: the number of bytes of input to encode
`flags` | `int`: controls certain features of the encoded output. Passing `DEFAULT` results in output that adheres to RFC 2045.

Returns
`byte[]` |

### encodeToString

    public static String encodeToString (byte[] input,
                    int offset,
                    int len,
                    int flags)

Base64-encode the given data and return a newly allocated String with the result.

Parameters
`input` | `byte`: the data to encode
`offset` | `int`: the position within the input array at which to start
`len` | `int`: the number of bytes of input to encode
`flags` | `int`: controls certain features of the encoded output. Passing `DEFAULT` results in output that adheres to RFC 2045.

Returns
`String` |

### encodeToString

    public static String encodeToString (byte[] input,
                    int flags)

Base64-encode the given data and return a newly allocated String with the result.

Parameters
`input` | `byte`: the data to encode
`flags` | `int`: controls certain features of the encoded output. Passing `DEFAULT` results in output that adheres to RFC 2045.

Returns
`String` |

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*