[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FW: [cp-patches] FYI: OpeningRandomAccessFilesrequiresexcessivepermissio
From: |
Jeroen Frijters |
Subject: |
FW: [cp-patches] FYI: OpeningRandomAccessFilesrequiresexcessivepermission |
Date: |
Fri, 9 Dec 2005 15:32:04 +0100 |
Hi Gary,
(sorry about the incorrect private e-mail)
To do it like this instead:
+ if ((fdmode & FileChannelImpl.WRITE) != 0)
+ out = new DataOutputStream (new FileOutputStream (fd));
+ else
+ out = new DataOutputStream (new OutputStream() {
+ public void write(int b) throws IOException {
+ throw new IOException("File not open for writing");
+ }
+ });
Regards,
Jeroen
> -----Original Message-----
> From: address@hidden
> [mailto:address@hidden
> On Behalf Of Gary Benson
> Sent: Friday, December 09, 2005 11:24
> To: address@hidden
> Subject: Re: [cp-patches] FYI:
> OpeningRandomAccessFilesrequiresexcessivepermission
>
> Hi Jeroen, David,
>
> What was the point?
>
> Cheers,
> Gary
>
> Jeroen Frijters wrote:
> > Hi Gary,
> >
> > David Daney made a good point that reminded me that it probably
> > wasn't as clever as I thought to extend the FilterOutputStream, so
> > extend OutputStream and implementing all methods would be a better
> > idea. I also liked David's suggestion of making this a reusable
> > utility class in gnu.java.io.*.
> >
> > (and just to be complete, I agree with the others that the exception
> > text should be changed as well.)
> >
> > Regards,
> > Jeroen
> >
> > > -----Original Message-----
> > > From: address@hidden
> > > [mailto:address@hidden
> > > On Behalf Of Gary Benson
> > > Sent: Thursday, December 08, 2005 17:25
> > > To: address@hidden
> > > Subject: Re: [cp-patches] FYI: Opening
> > > RandomAccessFilesrequiresexcessivepermission
> > >
> > > Hi Jeroen,
> > >
> > > Oh, in that case I'll use your patch, assuming nobody objects.
> > > The mauve test ought to spot anything that slips through.
> > >
> > > Cheers,
> > > Gary
> > >
> > > Jeroen Frijters wrote:
> > > > Hi Gary,
> > > >
> > > > I used a FilterOutputStream because that funnels all writes into
> > > > the write(int b) method, so you'd only have to override that
> > > > single method.
> > > >
> > > > Personally I wouldn't really like a solution based on
> > > > FileChannelImpl, but that's simply because IKVM uses a modified
> > > > version FileChannelImpl.
> > > >
> > > > Regards,
> > > > Jeroen
>
>
> _______________________________________________
> Classpath-patches mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/classpath-patches
>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FW: [cp-patches] FYI: OpeningRandomAccessFilesrequiresexcessivepermission,
Jeroen Frijters <=