• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Java 5 and Binary Files

 
Author
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is the combination of FileInputStream/FileOutputStream with DataInputStream/DataInputStream still the prefered way to teach Binary Files in Java 5.

Some books use File class since it handles both text and binary files- but it add another layer of chaining:



Could a DataOutputStream directly handle the File class:


Haven't tryed it yet- asking for opinions about the Binary Files at this point..Thanks JC
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The File class is just a representation of a pathname or filename in the file system. It doesn't have anything to do with the contents of the file.

Your second piece of code will not compile, because class java.io.DataOutputStream does not have a constructor that takes a java.io.File as the argument. You could have discovered that quickly by writing a small program yourself.
reply
    Bookmark Topic Watch Topic
  • New Topic