File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes nio curiosity Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "nio curiosity" Watch "nio curiosity" New topic

nio curiosity

Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
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?

--------<br />Andy Zhu<br />scjp 1.4<br />scjd 1.4<br />SAS Certified Programmer 9.0
Andrew Monkhouse
author and jackaroo
Marshal Commander

Joined: Mar 28, 2003
Posts: 11778

Hi Andy,

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).

Regards, Andrew

The Sun Certified Java Developer Exam with J2SE 5: paper version from Amazon, PDF from Apress, Online reference: Books 24x7 Personal blog
Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
Thanks, Andrew:

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.
Andy Zhu
Ranch Hand

Joined: May 26, 2004
Posts: 145
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).

Javini Javono
Ranch Hand

Joined: Dec 03, 2003
Posts: 286

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).

Javini Javono
Consider Paul's rocket mass heater.
subject: nio curiosity
jQuery in Action, 3rd edition