Folge dem Video um zu sehen, wie unsere Website als Web-App auf dem Startbildschirm installiert werden kann.
Anmerkung: Diese Funktion ist in einigen Browsern möglicherweise nicht verfügbar.
/**
*
*/
package de.tutorials.training;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
/**
* @author Tom
*
*/
public class NumberToFileWritingExample {
/**
* @param args
*/
public static void main(String[] args) throws Exception {
File binaryFile = new File("c:/numbers.dat");
DataOutputStream dataOutputStream = new DataOutputStream(
new FileOutputStream(binaryFile));
dataOutputStream.writeInt(Integer.MAX_VALUE);
dataOutputStream.close();
DataInputStream dataInputStream = new DataInputStream(
new FileInputStream(binaryFile));
int value = dataInputStream.readInt();
dataInputStream.close();
System.out.println(value);
// -----------------------------
File textFile = new File("c:/numbers.txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(textFile));
bw.write(String.valueOf(Integer.MAX_VALUE));
bw.newLine();
bw.close();
BufferedReader br = new BufferedReader(new FileReader(textFile));
String number = br.readLine();
br.close();
System.out.println(number);
}
}