Read double from DataInputStream : DataInputStream « File « Java Tutorial

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
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Tutorial » File » DataInputStream 
11. 17. 5. Read double from DataInputStream
import java.io.DataInputStream;
import java.io.EOFException;
import java.io.FileInputStream;
import java.io.IOException;

public class MainClass {

  public static void main(String[] args) {
    try {
      FileInputStream fin = new FileInputStream("myFile.dat");
      DataInputStream din = new DataInputStream(fin);
      while (true) {
        double theNumber = din.readDouble();
        System.out.println(theNumber);
      }
    catch (EOFException e) {
    catch (IOException e) {
      // abnormal termination
      System.err.println(e);
    }
  }
}
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.
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.