Hallo.
Ich hab beim bisschen rumspielen was entdeckt, bei dem ich nicht verstehe warum das so ist.
Erstmal der Code:
public static void main(String[] args) {
Song s = null, s2 = null, s3 = null, s4 = null, s5 = null;
try {
s = new Song(new File("D:\\Musik\\Musik-Oberordner\\Favoriten\\Mark Forster feat Sido Au Revoir Lyrics.mp3"));
s2 = new Song(new File("D:\\Musik\\Musik-Oberordner\\Favoriten\\02-keha-tik_tok-.mp3"));
s3 = new Song(new File("D:\\Musik\\Musik-Oberordner\\Favoriten\\107-stromae_-_housellelujah.mp3"));
s4 = new Song(new File("D:\\Musik\\Musik-Oberordner\\Favoriten\\07-ich_und_ich_-_mach_dein_licht_an.mp3"));
s5 = new Song(new File("D:\\Musik\\Musik-Oberordner\\Favoriten\\Dutty Moonshine - Takin' It Back.wav"));
} catch (UnsupportedAudioFileException | IOException ex) {
ex.printStackTrace();
}
try {
System.out.println("Song 1: " + toString(s.getId3TagV2()));
System.out.println("Song 2: " + toString(s2.getId3TagV2()));
System.out.println("###");
System.out.println("Song 3: " + toString(s3.getId3TagV2()));
System.out.println("###");
System.out.println("Song 4: " + toString(s4.getId3TagV2()));
System.out.println("Song 5: " + toString(s5.getId3TagV2()));
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
} catch (IOException ex) {
ex.printStackTrace();
}
}
public static String toString(ByteArrayInputStream is) {
if (is != null) {
int size = is.available();
byte[] bytes = new byte[size];
is.read(bytes, 0, size);
try {
return new String(bytes, "UTF-8");
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
return new String(bytes);
} else {
return "";
}
}```
So,die Ausgabe ist jetz folgendes (Ich habe um die entsprechende Ausgabe jeweils ne "###" Ausgabe getan, um das besser zu separatieren):
Wieso wird bei Song 3 das "Song 3: " nicht mit ausgegeben?