I am trying to read and write metadata to/from an mp3 file. I can read the data, but I cannot figure out how to write it.
I use the following code to get file access:
FileConnection file = (FileConnection) Connector.open("file:///store/home/user/music/song.mp3");
if(file.exists())
java.io.InputStream inputStream = file.openInputStream();
Later, I read the data using the following code:
buffer = new byte[length]; // length is predetermined earlier
if (inputStream.read(buffer, 0, length) == length)
String info = new String((buffer));
How do I write data (bytes) to the a designated location in the file? I am unsure of both the IO declarations and the specific code required to output my bytes.