29.07.2013 Views

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

Master of Science thesis Fighting Spam

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

e);<br />

e);<br />

e);<br />

}<br />

}<br />

Session session = Session.getInstance(props, null);<br />

//session.setDebug(true);<br />

try<br />

{<br />

FileInputStream iFile = new FileInputStream(file);<br />

MimeMessage msg = new MimeMessage(session, iFile);<br />

iFile.close();<br />

return msg;<br />

}<br />

catch(IOException e)<br />

{<br />

Debugger.debug(className,3,"The file could not be read. Please try again." +<br />

throw e;<br />

}<br />

catch(Exception e)<br />

{<br />

Debugger.debug(className,3,"The file could not be read. Please try again." +<br />

}<br />

throw e;<br />

public static void writeMimeFile(MimeMessage msg, String filename)<br />

{<br />

try<br />

{<br />

FileOutputStream oFile = new FileOutputStream(filename);<br />

//ObjectOutputStream oStream = new ObjectOutputStream(oFile);<br />

}<br />

msg.writeTo(oFile);<br />

oFile.close();<br />

}<br />

catch(FileNotFoundException e)<br />

{<br />

Debugger.debug(className,3,"Could not create file" + e);<br />

}<br />

catch(IOException e)<br />

{<br />

Debugger.debug(className,3,"The file could not be saved. Please try again." +<br />

}<br />

catch(Exception e)<br />

{<br />

Debugger.debug(className,3,"The file could not be saved." + e);<br />

}<br />

10.5.8 PackageQueue<br />

package <strong>Spam</strong>Cash.Utilities;<br />

import java.util.Vector;<br />

import <strong>Spam</strong>Cash.Utilities.Debugger;<br />

import <strong>Spam</strong>Cash.Utilities.MimePacket;<br />

public class PackageQueue extends Thread<br />

{<br />

private boolean isWaiting;<br />

private Vector queue;<br />

public PackageQueue()<br />

{<br />

isWaiting = false;<br />

queue = new Vector();<br />

414

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!