🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #2265

File locked after stream closed

#2265
From: Al Mal
Date: Sat, 14 Apr 2001 03:26
27 lines
1736 bytes
This nearly drove me crazy. I have a piece of code which runs under Win2K
where I read from a URL and save to a file.

    URL uDownloader;
    InputStream isURLStream;
    FileOutputStream osFileStream;

      uDownloader = new URL(upParser.GetProtocol(),
                                                  upParser.GetHost(),

upParser.GetDir()+upParser.GetFileName());
      isURLStream = uDownloader.openStream();
      osFileStream = new FileOutputStream(upParser.GetFileName());

      while (iChunk > 0)
      {
        iChunk = isURLStream.read(bBuffer, 0, 102400);
        osFileStream.write(bBuffer, 0, iChunk);
      }

      osFileStream.close(); // closig file stream
      isURLStream.close(); // closing connection to the URL content

The problem is that the resulting file is kept locked until I exit from the
application. I need it unlocked - how?

Alex
Technical Details
Message-ID: <3ad7c343$1_2@dnews>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed.icl.net!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,ea1112c189c5d22f,start
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2001-04-13 20:44:04 PST
From: "Al Mal" <alex.im@nospam.usa.net>
Newsgroups: borland.public.jbuilder.java.api
Subject: File locked after stream closed
Date: Fri, 13 Apr 2001 23:26:52 -0400
Lines: 29
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 64.231.12.68
Message-ID: <3ad7c343$1_2@dnews>
X-Trace: dnews 987218755 64.231.12.68 (13 Apr 2001 20:25:55 -0700)
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!logbridge.uoregon.edu!news.maxwell.syr.edu!newsfeed.icl.net!colt.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews