Re: [R] Image from bytes streams

From: Earl F. Glynn <efg_at_stowers-institute.org>
Date: Wed 17 Aug 2005 - 05:34:15 EST

"Márcio de Medeiros Ribeiro" <marcinhosbt@gmail.com> wrote in message news:<76189e25050816063321b42d24@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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Aug 17 05:48:15 2005

This archive was generated by hypermail 2.1.8 : Sun 23 Oct 2005 - 15:24:22 EST