如下修改 MP3 文件会导致内存不足错误。无论如何我可以更有效地执行以下操作(即使用更少的内存)
public void BacaMP3(){
String a = System.getProperty("user.dir") + "/src/MP3/21.waltz-cut.mp3";
String bitMP3="";
try {
File song = new File(a);
FileInputStream file = new FileInputStream(song);
int input = 0;
System.out.println("Creating file ...");
while (input != -1) {
input = file.read();
count++;
if (input==-1)bitMP3="#";
else{
bitMP3 = Integer.toBinaryString(input);
while(bitMP3.length()<8){
bitMP3="0"+bitMP3;
}
}
area1.append(bitMP3+"\n");
}
System.out.println(count);
file.close();
System.out.println("Done");
} catch (Exception e) {
System.out.println("Error  " + e.toString());
}
}