dcsimg
ByteBuffer in java.nio.* - can I really use it?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alex_Cai
Posted On:   Monday, July 15, 2002 06:20 PM

In the java 1.4 doc, the ByteBuffer class is defined as abstract, and many of its methods (including most of the get and put methods) are also defined as abstract.

many articles/people have talked about using the nio package and the ByteBuffer (http://javaalmanac.com/egs/java.nio/CreateBuf.html).

I want to use this ByteBuffer class, do I need to implement all those abstract methods before I can use it? or there exists some already implemented package that I am not aware of.

Many thanks in advance,

Alex

Re: ByteBuffer in java.nio.* - can I really use it?

Posted By:   Alex_Cai  
Posted On:   Monday, July 15, 2002 08:04 PM

How about for the methods that declared as absctract, such as pubInt(), putDouble(), putLong()? can I use them directly?

The funny thing is that I wrote a testing program, and tried to use these methods, and they seem to work fine even though they are abstract methods. And, i unzipped the java source file that came with jdk1.4, and when i look into the ByteBuffer.java code, these classes are real abstract classes, and are not implemented in the source...

This is weired, and I don't know whether I should use this class or not. Anyone can help?

Also, anyone knows the best way of getting the four individual bytes out of an integer (and other primitive types such as double, long, etc?)

Thanks,
Alex
About | Sitemap | Contact