I have assignment of B&S 2.2.2 and plan to use nio for file operation. I noticed that there were some threads in early of this year talking about prohibition of nio by sun on assignment. I searched my instruction and find no single mention of nio at all. Does SUN allows nio or I missed something? What is the story about it?
The ban on NIO (and a few other questionable statements) are listed in the Sun SCJD Description - there are a group of APIs which are listed as being forbidden. Most of the APIs that are forbidden you probably wouldn't want to use anyway, but we don't know why they are trying to ban NIO.
Regardless of the information on the description page, what is written in your instructions takes precedence. There are multiple assignment types in use at the moment (Fly By Night Services (airline), URLyBird (hotel), and Bodgitt & Scarper (contractors). And there are multiple versions of each of those assignments. Presumably the instructions for at least one version of one of those assignments does have the ban on NIO. But most do not.
But if the instructions you received do not ban NIO, then you are free to use it (as described in this post).
I searched my instruction html, no return of nio. So I think I can use nio. I am not sure I am lucky or not. Anyway, I like to try this new feature, because I think to get certified is also a part of learing process.
Joined: May 26, 2004
I think I am out of luck. In the data format section, it says that the format is encoded in DataInputStrem/Output for numeric and ASCII for text. So I think I have to use the traditional io. But for me, it is a familar friend. Anyway, still doable.
So forget my previous reply if it might confuse you (it confused me).
Look at those two "Stream" words you posted above one more time. Then look at the RandomAccessFile class. Do you find that those are really interfaces? So, this means, for example, that if you use RandomAccessFile that it has the interfaces that would be compatible with the file.
Now, not being an NIO expert, what little I know suggests that if you can use a RandomAccessFile, then you can use NIO. Because the NIO "communication object" can be extracted from a RandomAccessFile object (or probably from many file access objects, of which RandomAccessFile would be but one example).