Article View: borland.public.jbuilder.java.api
Article #994Re: OutOfMemoryError
From: Owen Green
Date: Wed, 03 Jul 2002 12:20
Date: Wed, 03 Jul 2002 12:20
38 lines
2654 bytes
2654 bytes
"Alan Shiers" <ashiers@hfx.eastlink.ca> wrote in message
news:3D226288.1C7C905@hfx.eastlink.ca...
> Hi guys,
>
> I've been busy trying to implement the new code and I'm having a problem
> with the conditional statement of the while loop.
>
> myFile = new File("C:\somepath\somefile");
> if(myFile.exists())System.out.println("file exists");
> FileIn = new FileInputStream(myFile);
>
> byte[] buffer = new byte[128];
> int n;
> while((n = FileIn.read(buffer)) >= 0) << Problem line
> {
> rq.output.write(buffer);
> }
>
> The FileIn object is a FileInputStream object and everytime at runtime I
> get an IOException stating that it has a "Bad file descriptor". I don't
> understand what it is telling me or how to fix it.
>
> Earlier, I had created a File object using an absolute file path and
> file name. Even tested it with the File.exists() method, which returned
> true, and used the File object as an arguement for the FileInputStream
> object, like so: FileIn = new FileInputStream(myFile);
Isn't that exactly what you've shown above?
> What is causing this "Bad file descriptor" thing?
I'm not sure :) It could be
a) That it doesn't understand what you're asking it; are you really writing
win32 paths as "c:\blah\blah" as oppossed to "c:\\blah\\blah" or
"c:/blah/blah"?
b) There are a limited number of FD's available, afaik, do you have lots
open at any one time? (this includes sockets, btw).
Technical Details
Message-ID:
<3d22ec28_1@dnews>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!newspump.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnewsReferences:
<3D20CC5D.B70473C9@hfx.eastlink.ca> <MPG.178acb912dba8f7998b79d@newsgroups.borland.com> <3D21C1CA.F2D953E2@hfx.eastlink.ca> <3d21bb44_1@dnews> <3D21EC78.228A5CD3@hfx.eastlink.ca> <3d21e07b_2@dnews> <3D226288.1C7C905@hfx.eastlink.ca>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1089d0,28eab50e784856ac X-Google-Attributes: gid1089d0,public X-Google-ArrivalTime: 2002-07-03 05:29:18 PST From: "Owen Green" <owen@begonefoulmachine.kennulz.demon.co.uk> Newsgroups: borland.public.jbuilder.java.api References: <3D20CC5D.B70473C9@hfx.eastlink.ca> <MPG.178acb912dba8f7998b79d@newsgroups.borland.com> <3D21C1CA.F2D953E2@hfx.eastlink.ca> <3d21bb44_1@dnews> <3D21EC78.228A5CD3@hfx.eastlink.ca> <3d21e07b_2@dnews> <3D226288.1C7C905@hfx.eastlink.ca> Subject: Re: OutOfMemoryError Date: Wed, 3 Jul 2002 13:20:51 +0100 Lines: 45 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 193.237.54.9 Message-ID: <3d22ec28_1@dnews> X-Trace: dnews 1025698856 193.237.54.9 (3 Jul 2002 05:20:56 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!newspump.sol.net!priapus.visi.com!news-out.visi.com!hermes.visi.com!newsfeed.news2me.com!newsfeed2.earthlink.net!newsfeed.earthlink.net!lsanca1-snf1!news.gtei.net!enterprise!news.xtra.co.nz!newsfeeds.ihug.co.nz!ihug.co.nz!dnews