Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IO Streams to use

 
Clivant Yeo
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ranchers,

Regarding the use of IO Streams, which stream should I use? Is DataInputStream and DataOutputStream a compulsory?

Thanks.
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11855
186
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Clivant,

DataInputStream and DataOutputStream are not compulsory - you can use any classes you like. Since you will be updating individual records in the file, you may want to look at RandomAccessFile which can be used for both reading and writing.

You should check your instructions for any mention of NIO. Some of the latest instructions specify that NIO may not be used. But if you don't have any such instruction, then you may use NIO if you like.

Regards, Andrew
 
Clivant Yeo
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Andrew, I note your point.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic