com.dynamide.util
Class Base64Decoder

java.lang.Object
  extended by com.dynamide.util.Base64Decoder

public class Base64Decoder
extends java.lang.Object

Decode a BASE64 encoded input stream to some output stream. This class implements BASE64 decoding, as specified in the MIME specification.

See Also:
w3c.tools.codec.Base64Decoder

Constructor Summary
Base64Decoder(java.io.InputStream in, java.io.OutputStream out)
          Create a decoder to decode a stream.
Base64Decoder(java.lang.String input)
          Create a decoder to decode a String.
 
Method Summary
static void main(java.lang.String[] args)
          Test the decoder.
 void process()
          Do the actual decoding.
 java.lang.String processString()
          Do the decoding, and return a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64Decoder

public Base64Decoder(java.lang.String input)
Create a decoder to decode a String.

Parameters:
input - The string to be decoded.

Base64Decoder

public Base64Decoder(java.io.InputStream in,
                     java.io.OutputStream out)
Create a decoder to decode a stream.

Parameters:
in - The input stream (to be decoded).
out - The output stream, to write decoded data to.
Method Detail

process

public void process()
             throws java.io.IOException,
                    Base64FormatException
Do the actual decoding. Process the input stream by decoding it and emiting the resulting bytes into the output stream.

Throws:
java.io.IOException - If the input or output stream accesses failed.
Base64FormatException - If the input stream is not compliant with the BASE64 specification.

processString

public java.lang.String processString()
                               throws Base64FormatException
Do the decoding, and return a String. This methods should be called when the decoder is used in String mode. It decodes the input string to an output string that is returned.

Throws:
java.lang.RuntimeException - If the object wasn't constructed to decode a String.
Base64FormatException - If the input string is not compliant with the BASE64 specification.

main

public static void main(java.lang.String[] args)
Test the decoder. Run it with one argument: the string to be decoded, it will print out the decoded value.



Copyright 2001-2013 DYNAMIDE.COM. All Rights Reserved.