This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: what's the point of java.nio?
- From: Bryce McKinlay <mckinlay at redhat dot com>
- To: Adam Megacz <adam at megacz dot com>
- Cc: java at gcc dot gnu dot org
- Date: Mon, 31 May 2004 10:35:58 -0400
- Subject: Re: what's the point of java.nio?
- References: <m1u0xx71ka.fsf@nowhere.com>
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