🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.jbuilder.java.api
4 messages
4 total messages Started by Oliver Young Fri, 01 Aug 2003 07:39
Reading from a file
#523
Author: Oliver Young
Date: Fri, 01 Aug 2003 07:39
6 lines
1216 bytes
    I have one app that runs 24h per day, checking one folder every 30 sec.
It should import into DB file that user can copy into one folder. The
problem is that file might be even 30 MB long, so my app would start reading
from file before whole file was written into destination folder. Is there
some workaround (to check if whole file was written)?
Re: Reading from a file
#524
Author: Shankar Unni
Date: Fri, 01 Aug 2003 19:54
11 lines
1561 bytes
Oliver Young wrote:

> [...] my app would start reading
> from file before whole file was written into destination folder.

One basic idea: make your app ignore files with a specific ending (e.g.
.tmp), and make the user copy the file in using a two-step process:
first copy the file into /your/location/new-file.tmp, and once the copy
is done, rename new-file.tmp to new-file.

(Or other variations of this).
Re: Reading from a file
#526
Author: lredmond
Date: Sun, 03 Aug 2003 02:51
17 lines
1726 bytes
te best way to do this is to have the file end with a trailer record, before
you read the entire file, seek to te\he end of the file and look for a
trailer record, I usually put EOF00001123
which is the end of file plus the number of records, if you seek to the end
and the EOF marker is not found then ignore the file
"Oliver Young" <no@spam.please> wrote in message
news:3f2a1901$1@newsgroups.borland.com...
>
>     I have one app that runs 24h per day, checking one folder every 30
sec.
> It should import into DB file that user can copy into one folder. The
> problem is that file might be even 30 MB long, so my app would start
reading
> from file before whole file was written into destination folder. Is there
> some workaround (to check if whole file was written)?
>
>
Re: Reading from a file
#528
Author: John McGrath [TeamB]
Date: Tue, 05 Aug 2003 06:07
15 lines
1511 bytes
On 8/1/2003 at 3:54:18 PM, Shankar Unni wrote:

> One basic idea: make your app ignore files with a specific ending
> (e.g.  .tmp), and make the user copy the file in using a two-step
> process:  first copy the file into /your/location/new-file.tmp, and
> once the copy is done, rename new-file.tmp to new-file.

Another approach along the same lines is to create the file in a
different directory on the same device as the input directory.  After
the file has been created, rename it to the input directory.

-- 
Regards,

John McGrath  [TeamB]
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads