Txt datei von Website downloaden

  • Themenstarter Themenstarter Gas2142151
  • Beginndatum Beginndatum
G

Gas2142151

Gast
Hi,

ich suche ein Tutorial was beschreibt wie ich eine .txt datei von einer Website downloade und ein extra tut um die dann zeile für zeile auszulesen.

Lg
 
Hallo Gast,

versuch es mal mit folgendem:

Java:
URL url = new URL("http://www.example.com/test.txt");
		HttpURLConnection conn = (HttpURLConnection) url.openConnection();

		InputStream inputStream = (InputStream) conn.getContent();
		Scanner scanner = new Scanner(inputStream);

		while (scanner.hasNext()) {
			System.out.println(scanner.nextLine());
		}

Grüße
 
Google hat dir nicht geholfen?

Richtig habe dort nichts brauchbares gefunden.

Hallo Gast,

versuch es mal mit folgendem:

Java:
URL url = new URL("http://www.example.com/test.txt");
		HttpURLConnection conn = (HttpURLConnection) url.openConnection();

		InputStream inputStream = (InputStream) conn.getContent();
		Scanner scanner = new Scanner(inputStream);

		while (scanner.hasNext()) {
			System.out.println(scanner.nextLine());
		}

Grüße

Ich werde das mal Versuchen

Lg
 

Zurück
Oben