Skip to content
Back to formatted view

Raw Message

Message-ID: <ddtf3o$tee$1@sea.gmane.org>
Date: 2005-08-16T19:34:15Z
From: Earl F. Glynn
Subject: Image from bytes streams

"M??rcio de Medeiros Ribeiro" <marcinhosbt at gmail.com> wrote in message
news:<76189e25050816063321b42d24 at mail.gmail.com>...
>My big problem is that my program reads the image before that its
>complete by the png() function. For instance, my graphic image has
>1000Kb. When R saves it into the hard disk, my Java program reads the
>file before the save operation completes (500Kb for example). So, I
>got only a part of the file and hence the image... :(
>
>One solution is read the image and search for a byte which represents
>the end of the file, but it depends on the image format...

Have you considered in R writing the file to a temporary name (see
?tempfile). When the file is complete, after the dev.off() in R as suggested
by Prof Ripley, you could rename the file [using file.name() in R]. Your
external program can now access the file without worrying about whether it
is complete, since the file appears not to exist until the whole file has
been written.

efg