what's the point of java.nio?

Bryce McKinlay mckinlay@redhat.com
Mon May 31 14:59:00 GMT 2004


Adam Megacz wrote:
>It looks like given these two functions I could implement all of
>java.nio on top of java.io. And the converse (io on nio) is certainly
>true (libgcj does it).
>>
Buffers are quite useful, especially DirectBuffers. Its nice to be able 
to pass around "chunks of memory that have state", rather than simply 
calling methods that copy into arrays. Although, in practice, since 
there isn't any real language support for Buffers, you end up either 
doing array copies anyway or making lots of inefficient get() calls. But 
for file I/O for example, being able to view the same buffer as (eg) 
ints, chars, or bytes is nice.
Regards
Bryce


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /