This week's book giveaway is in the Big Data forum.
We're giving away four copies of Elasticsearch in Action and have Radu Gheorghe & Matthew Lee Hinman 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 Elasticsearch in Action this week in the Big Data forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "java.nio.ByteBuffer?" Watch "java.nio.ByteBuffer?" New topic
Author

java.nio.ByteBuffer?

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 (java.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
Bartender

Joined: Jul 19, 2004
Posts: 6060
    
  20

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


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

Joined: Dec 28, 2007
Posts: 2269
    
    3

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()
 
rocket mass heater kickstarter
 
subject: java.nio.ByteBuffer?