Read boolean from file using DataInputStream : DataInputStream « File « Java Tutorial

Home
Java Tutorial
1.Language
2.Data Type
3.Operators
4.Statement Control
5.Class Definition
6.Development
7.Reflection
8.Regular Expressions
9.Collections
10.Thread
11.File
12.Generics
13.I18N
14.Swing
15.Swing Event
16.2D Graphics
17.SWT
18.SWT 2D Graphics
19.Network
20.Database
21.Hibernate
22.JPA
23.JSP
24.JSTL
25.Servlet
26.Web Services SOA
27.EJB3
28.Spring
29.PDF
30.Email
31.J2ME
32.J2EE Application
33.XML
34.Design Pattern
35.Log
36.Security
37.Apache Common
38.Ant
39.JUnit
Java Tutorial » File » DataInputStream 




import java.io.DataInputStream;
import java.io.FileInputStream;

public class Main {

  public static void main(String[] argsthrows Exception {
    FileInputStream fin = new FileInputStream("C:/n.txt");
    DataInputStream din = new DataInputStream(fin);
    boolean b = din.readBoolean();
    System.out.println("boolean : " + b);
    din.close();
  }
}














11.17.DataInputStream
11.17.1.Create DataInputStream from FileInputStream
11.17.2.Create DataInputStream from BufferedInputStream and FileInputStream
11.17.3.Create DataInputStream from ByteArrayInputStream
11.17.4.Read int from DataInputStream
11.17.5.Read double from DataInputStream
11.17.6.Read double and UTF from DataInputStream with BufferedInputStream backended
11.17.7.Read boolean from file using DataInputStream
11.17.8.Read byte array from file using DataInputStream
11.17.9.Read byte from file using DataInputStream
11.17.10.Read char from file using DataInputStream
11.17.11.Read float from file using DataInputStream
11.17.12.Read long from file using DataInputStream
11.17.13.Read short from file using DataInputStream
11.17.14.Read unsigned byte from file using DataInputStream
11.17.15.Check the class version
11.17.16.Create a compressed data file by using a DeflaterOutputStream and then read that data through an InflaterInputStream.
11.17.17.Use DataInputStream to create double
11.17.18.Testing for end of file while reading a byte at a time.
11.17.19.This class is an part implementation of DataInput. It wraps a Reader object.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.