This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes java.nio.ByteBuffer? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "java.nio.ByteBuffer?" Watch "java.nio.ByteBuffer?" New topic


Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

Is it allowed to use java.nio.ByteBuffer? Did anyone who passed use it?

The Oracle webpage says that you have to use Standard file IO (, not java.nio), and it also says NIO, the New IO facilities cannot be used.

But I am not using ByteBuffer for file I/O operations, I even wonder why is ByteBuffer in NIO package. I want to use it to buffer data before writing to database file.

Personal page, SCJP 6 with 91%, SCWCD 5 with 84%, OCMJD
Roel De Nijs

Joined: Jul 19, 2004
Posts: 5139

I just used a byte[] to write everything to file, using a RandomAccessFile

SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
Roberto Perillo

Joined: Dec 28, 2007
Posts: 2258

Well champ, I'd say that, for whatever you are using it, you are not allowed to do so.

Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

Thanks for the answers!

I used byte[], Strinng.getBytes(), System.arraycopy() and Arrays.fill()
I agree. Here's the link:
subject: java.nio.ByteBuffer?
Similar Threads
End of file indication
Writing a String to a File using FileChannel
issue with files reading and processing
NIO and performance question