Hey,
Iv been working a lot with binary files recently and i am currently stuck trying to save a string to a file.
The problem is i do not want the literal string value of
"010100000000000100010011000000000001000100110" to be saved to the file
I want the above binary string to be saved as if it were part of the file and not just a series of 1's and 0's as this results in the fie being made of hex values 30 and 31.
OutputStream out = new FileOutputStream("MyFile");
try {
//add in file size at the end and append to here
RECT b = new RECT(550,400);
out.write(b.GETRECTANGLE().getBytes());
out.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
//seperate class below
String GETRECTANGLE()
{
//just used for example
String output = "010100000000000100010011000000000001000100110";
return output;
}
The file specification im working with states that the 45 binary bits are stored as a "bit stream" and output to a file. and thats the result i am trying to achieve, not just merely output the string to a file. Any help would be great, and the basic info for the format im working with is :
http://csharksgames.blogspot.co.uk/2010/08/hacking-swf-slides.html