[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: New IO Native Provider Interface
From: |
Jeroen Frijters |
Subject: |
RE: New IO Native Provider Interface |
Date: |
Thu, 6 Mar 2003 08:15:14 +0100 |
Hi,
Aaron M. Renn wrote:
> Jeroen Frijters (address@hidden) wrote:
> > - FileOutputStream should not request read access, so the
> modes should
> > be "w" and "a"
>
> Good observation. Have you actually tested the JDK to see what it
> does in this situation? Is the file actually opened "write only"?
Yes, I have. Test code is attached (it should fail with
"java.io.IOException: Access is denied"). Additionally, FileOutputStream
(when it is not in append mode) should truncate the file if it already
exists, so it also needs to use a different mode because of this.
> > - write(byte[] buf, long offset, long length) should not
> use longs for
> > offset and length
>
> I take it that you are referring to the Java write() method I
> added to the
> FileDescriptor class and not the nativeWriteBuf() method. I'm ok with
> modifying this.
Yes.
>I do typically want to use longs for native calls.
Why? Is it expensive to use ints on 64 bit architectures?
> > - nativeReadByte shouldn't return a long
>
> Why not? All of the rest of the native methods that return values
> return longs.
I missed the others. IMHO only file offsets and native pointers should
be long, all others should be the most natural type. In this case I
think that's int.
> > - I don't think available() should return negative numbers
>
> Does it? I certainly didn't intend for it to.
Not it doesn't, sorry, apparantly I wasn't awake yet.
Regards,
Jeroen
P.S. I'm going on vacation for a week and I won't be able to read my
e-mail.
iotest.java
Description: iotest.java