Java examples for File Path IO:DataInputStream
Read boolean from file using DataInputStream
import java.io.DataInputStream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; public class Main { public static void main(String[] args) { String strFilePath = "C://Folder//readBoolean.txt"; /* w w w .jav a 2s. co m*/ try { FileInputStream fin = new FileInputStream(strFilePath); DataInputStream din = new DataInputStream(fin); boolean b = din.readBoolean(); System.out.println("boolean : " + b); din.close(); } catch(FileNotFoundException fe) { System.out.println("FileNotFoundException : " + fe); } catch(IOException ioe) { System.out.println("IOException : " + ioe); } } }