this is the class with the variables
package sample;
import java.io.*;
public class Main {
static String title;
static String artist;
static String album;
public static void main(String[] args) {
cheese();
String a=title;
System.out.println(a);
}
public static String cheese(){
try {
File song = new File("C:\\Users\\TheFishMoustache\\Music\\Indochine - L'aventurier.mp3");
FileInputStream file = new FileInputStream(song);
int size = (int) song.length();
file.skip(size - 128);
byte[] last128 = new byte[128];
file.read(last128);
String id3 = new String(last128);
String tag = id3.substring(0, 3);
if (tag.equals("TAG")) {
title = id3.substring(3, 32);
artist = id3.substring(33, 62);
album = id3.substring(63, 91);
} else {
System.out.println(" does not contain information.");
}
file.close();
} catch (Exception e) {
System.out.println("Error - " + e.toString());
}
return (title+album+artist);
}
}
and in the other class i have this snippet:
@FXML public TableView<Song> musiclist;
private ObservableList<Song> songs() {
List list = new ArrayList();
list.add(new Song("a","b","c"));
ObservableList<Song> info = FXCollections.observableArrayList(list);
return info;
}
where i want to replace "a","b" and "c" by the "title", "author" and "artist" variables, what code do i need to do this?