Urgent Help!!!!!!

i need to scan an exe file for virus signatures programmatically using java.... for that the file has to be converted into its binary format (machine code)... can this be done in java.... if so could anyone help me out.....
[230 byte] By [dinesh_chandera] at [2007-11-26 19:12:01]
# 1
Yes, Java can read a file in bytes.
zadoka at 2007-7-9 21:10:00 > top of Java-index,Java Essentials,Java Programming...
# 2
whats wront with macaffee?
mkoryaka at 2007-7-9 21:10:00 > top of Java-index,Java Essentials,Java Programming...
# 3

No, it doesn't have to be converted into binary format. It's already in binary format.

You read the bytes of the file and compare them against known virus patterns. Although the algorithm for that is probably much more complicated than the mechanics of reading a file, so you might be in over your head.

http://java.sun.com/docs/books/tutorial/essential/io/index.html

jverda at 2007-7-9 21:10:00 > top of Java-index,Java Essentials,Java Programming...
# 4

Don't flag your question as urgent, even if it is for you. Claiming urgency is very likely to be counter-productive: most forum regulars will simply ignore such messages as rude and selfish attempts to elicit immediate and special attention.

Besides, unless a pack of lusty wildebeest is about to chase you over the edge of a cliff if you don't get an answer in fifteen seconds, your problem probably isn't as urgent as you think. :o)

yawmarka at 2007-7-9 21:10:00 > top of Java-index,Java Essentials,Java Programming...
# 5

public class BinFormat

{

public static void main(String[] args) throws IOException

{

FileInputStream in = new FileInputStream("vcll.exe");

//FileOutputStream out = new FileOutputStream("out.bin");

int c;

while ((c = in.read()) != -1)

System.out.println(Integer.toBinaryString(c));

//out.write(c);

}

}

Thankyou.... but the while loop runs indefenitely.... the time it takes to complete the process is so large and the size of the output binary file is huge even if the input file is jus 100KB size.... This is the way that all virus scanners function? or am I making a notable mistake...

dinesh_chandera at 2007-7-9 21:10:00 > top of Java-index,Java Essentials,Java Programming...