au.gov.tas.dpiwe.mr.tool
Class DeMIME

java.lang.Object
  extended by au.gov.tas.dpiwe.mr.tool.DeMIME

public class DeMIME
extends Object

This tool extracts all MIME sections from a file, using Mr Architecture's ByteCharTranscoder for base64 parts. (Note: quoted-printable is not yet supported - the output is an eml file with the quotes intact.)

The encoded output is echoed as it is read.

Since:
Mr Architecture 3.3
Version:
1.0.0.0
Author:
Kade Hansson

Constructor Summary
DeMIME()
           
 
Method Summary
static void deBase64Block(BufferedReader input, OutputStream output)
          Produces a single output files from an input containing base 64 encoded lines.
static boolean deMIME(Reader input)
          Produces output files from an input containing MIME multipart sections.
static void main(String[] argv)
          Initiates the DeMIME tool.
static void otherBlock(BufferedReader input, OutputStream output)
          Produces a single output file from an input containing non-MIME boundary lines.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeMIME

public DeMIME()
Method Detail

main

public static void main(String[] argv)
                 throws Exception
Initiates the DeMIME tool.

Parameters:
argv - first argument is a filename.
Throws:
IOException - if the input file could not be read or the output file could not be written.
Exception - if something else goes wrong.

deMIME

public static boolean deMIME(Reader input)
                      throws IOException
Produces output files from an input containing MIME multipart sections.

Parameters:
input - the MIME multipart input, with encoded sections prefixed by "Content-Transfer-Encoding:" and "Content-Type:".
Returns:
if at least one output file was decoded, false otherwise.
Throws:
IOException - if the decoding could not proceed for whatever reason.

deBase64Block

public static void deBase64Block(BufferedReader input,
                                 OutputStream output)
                          throws IOException
Produces a single output files from an input containing base 64 encoded lines. Termination is at the first blank line. Non-base-64-encoded lines produce an IOException.

Parameters:
input - the base 64 input.
output - somewhere to write the decoded data.
Throws:
IOException - if the decoding could not proceed for whatever reason.

otherBlock

public static void otherBlock(BufferedReader input,
                              OutputStream output)
                       throws IOException
Produces a single output file from an input containing non-MIME boundary lines. Termination is at the first boundary line or EOF.

Parameters:
input - the 7-bit clear input.
output - somewhere to write the decoded data.
Throws:
IOException - if the decoding could not proceed for whatever reason.