Hello,
I have a script written in Java that gets me an answer from a script containing a number of files. The problem is I don't know how to code this in javaFX script as I am very new to it.

URL url = new URL(page);
        URLConnection conn = url.openConnection();
        conn.setDoOutput(true);
    
        // Get the response
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
        String line="";
        int i=0;
        while ((line = rd.readLine()) != null) {
            if(i>=2)
               songPaths[i-2]=line;


            i++;

        }

        rd.close();

I tried something like this... but I don't know how to use the constructors... the syntax so I need some help please.

var url:URL;
var conn:URLConnection;
var rd:BufferedReader;

conn.setDoOutput(true);

conn = url.openConnection();
conn.setDoOutput(true);
//the rest of code it's just buggy, doesn't compile as I don't know how to translate it from java to javaFX

Please help... thanks.