Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## edu.emory.mathcs.util.io
Class Base64Decoder

    java.lang.Object
      java.io.InputStream
          edu.emory.mathcs.util.io.Base64Decoder

public class Base64Decoder
extends java.io.InputStream

Input stream that decodes from base64 on-the-fly, that is, it converts base64-encoded character stream into a decoded byte stream. It also offers static methods for offline decoding, that is, converting base64-encoded strings into byte arrays.

Version:
  1.0
Author:
  Dawid Kurzyniec

Constructor Summary
`Base64Decoder(java.io.Reader in)` Creates a new base64 decoder that reads character from a specified reader.

Method Summary
`void` | `close()`
`static byte[]` | `decode(java.lang.String base64encoded)` Decodes a base64-encoded string into a byte array.
`static void` | `decode(java.lang.String base64encoded, byte[] buf)` Decodes a base64-encoded string and write the result to the specified byte array.
`static void` | `decode(java.lang.String base64encoded, byte[] buf, int off)` Decodes a base64-encoded string and write the result to the specified byte array at the given offset.
`int` | `read()`
`int` | `read(byte[] buf, int off, int len)`

Methods inherited from class java.io.InputStream
`available, mark, markSupported, read, reset, skip`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Base64Decoder

    public Base64Decoder(java.io.Reader in)

  Creates a new base64 decoder that reads character from a specified reader.

Parameters:
  `in` - the reader to read from

Method Detail

### read

    public int read(byte[] buf,
                    int off,
                    int len)
             throws java.io.IOException

  Throws:
    `java.io.IOException`

### read

    public int read()
             throws java.io.IOException

  Throws:
    `java.io.IOException`

### close

    public void close()
               throws java.io.IOException

  Throws:
    `java.io.IOException`

### decode

    public static byte[] decode(java.lang.String base64encoded)
                         throws java.lang.IllegalArgumentException

  Decodes a base64-encoded string into a byte array.

  Parameters:
    `base64encoded` - the string to decode
  Returns:
    decoded array
  Throws:
    `java.lang.IllegalArgumentException` - if the string is not valid base64

### decode

    public static void decode(java.lang.String base64encoded,
                              byte[] buf)
                       throws java.lang.IllegalArgumentException

  Decodes a base64-encoded string and write the result to the specified byte array.

  Parameters:
    `base64encoded` - the string to decode
    `buf` - the array to write to
  Throws:
    `java.lang.IllegalArgumentException` - if the string is not valid base64

### decode

    public static void decode(java.lang.String base64encoded,
                              byte[] buf,
                              int off)

  Decodes a base64-encoded string and write the result to the specified byte array at the given offset.

  Parameters:
    `base64encoded` - the string to decode
    `buf` - the array to write to
    `off` - the offset to start writing at
  Throws:
    `java.lang.IllegalArgumentException` - if the string is not valid base64

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD