I want to write the file as byte only and not the character.
String binaryString = "10110101"
I am using
byte mybyte = Byte.parseByte(binaryString,2);
I want to write this converted byte into the file as a byte and not the character.
I am using :
FileOutputStream fos1 = new FileOutputStream(new File("output"));
fos.write(mybyte);
But after write, when I see the files the byte is actually written as the characters.
Is I am doing something wrong in conversion ? How to make it write as byte and not char ?
Edit:
Like for the String 101101010111001011111000 (taking 8 bits at a time and then writing to the file) : it is converted to "Z9|".
Byte.parseBytewill throw an exception for that input...)