Package com.sun.ts.lib.util

# Class BASE64Decoder

java.lang.Object
com.sun.ts.lib.util.CharacterDecoder
com.sun.ts.lib.util.BASE64Decoder

public class BASE64Decoder extends CharacterDecoder
This class implements a BASE64 Character decoder as specified in RFC1521. This RFC is part of the MIME specification which is published by the Internet Engineering Task Force (IETF). Unlike some other encoding schemes there is nothing in this encoding that tells the decoder where a buffer starts or stops, so to use it you will need to isolate your encoded data into a single chunk and then feed them this decoder. The simplest way to do that is to read all of the encoded data into a string and then use:

     byte mydata[];
     BASE64Decoder base64 = new BASE64Decoder();

     mydata = base64.decodeBuffer(bufferString);

This will decode the String in bufferString and give you an array of bytes in the array myData. On errors, this class throws a CEFormatException with the following detail strings:

     "BASE64Decoder: Not enough bytes for an atom."

Author:
  Chuck McManis
See Also:
  - `CharacterEncoder`
  - `BASE64Decoder`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `BASE64Decoder()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected int`
  `bytesPerAtom()`
  This class has 4 bytes per atom
  `protected int`
  `bytesPerLine()`
  Any multiple of 4 will do, 72 might be common
  `protected void`
  `decodeAtom(PushbackInputStream inStream, OutputStream outStream, int rem)`
  Decode one BASE64 atom into 1, 2, or 3 bytes of data.

  ### Methods inherited from class com.sun.ts.lib.util.CharacterDecoder

  `decodeBuffer, decodeBuffer, decodeBuffer, decodeBufferPrefix, decodeBufferSuffix, decodeBufferToByteBuffer, decodeBufferToByteBuffer, decodeLinePrefix, decodeLineSuffix, readFully`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### BASE64Decoder

    public BASE64Decoder()

- ## Method Details

  - ### bytesPerAtom

    protected int bytesPerAtom()
    This class has 4 bytes per atom
    Specified by:
      `bytesPerAtom` in class `CharacterDecoder`

  - ### bytesPerLine

    protected int bytesPerLine()
    Any multiple of 4 will do, 72 might be common
    Specified by:
      `bytesPerLine` in class `CharacterDecoder`

  - ### decodeAtom

    protected void decodeAtom(PushbackInputStream inStream, OutputStream outStream, int rem) throws IOException
    Decode one BASE64 atom into 1, 2, or 3 bytes of data.
    Overrides:
      `decodeAtom` in class `CharacterDecoder`
    Throws:
      `IOException`