Binary

I would like to read a file and store the data in binary format in a string.

So that i can later insert it into the database - MySQL

I am able to read the file into a byte array.

How do i store the byte[] array into the string ?

byte[] buf = new byte[100]

// .... read file ...

String BinString = new String(buf);

Is this sufficient ?

[383 byte] By [Rajalaa] at [2007-10-2 7:03:54]
# 1
Use a DataInputStream or the like and read characters instead of bytes if you want to actually control what is going on.If the bytes represent the characters in your platform's default encoding, then yes, what you described will work.Drake
Drake_Duna at 2007-7-16 20:34:36 > top of Java-index,Other Topics,Algorithms...