🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #477

File Locking in IO classes

#477
From: Vander
Date: Tue, 19 Apr 2005 09:04
20 lines
1722 bytes
I wonder if there are standard file locking mechanisms implemented for 
the standard Java VM concerning the file IO classes, in a way that you 
can rely on. Let's focus on RandomAccessFile.

RandomAccessFile rf;
File file ... ;
String modus ... ;
rf = new RandomAccessFile( file, modus );

If I want to make sure (or as sure as possible from the Java 
perspective) that "file" is declared for "exclusive" access in the 
operating system, do I need to apply calls to rf.getChannel()? Or does 
it suffice to open rf in "rw" mode and the Java implementation already 
organizes this part for me?

Similar questions may be put for the other file IO classes, 
FileOutputStream and FileInputStream. I have found no assertions in the 
Java documents about any standard access modi activated.

- Vander
Technical Details
Message-ID: <4264c9b6@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!newsprint.newsread.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f74b3,a6ef220bf23e44de,start
X-Google-Attributes: gidf74b3,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Tue, 19 Apr 2005 11:04:44 +0200
From: Vander <874505@gmx.de>
User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: File Locking in IO classes
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 193.158.184.113
Message-ID: <4264c9b6@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1113901494 193.158.184.113 (19 Apr 2005 02:04:54 -0800)
Lines: 20
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news2.google.com!newsread.com!newsprint.newsread.com!38.119.100.83.MISMATCH!news-out.nntp.be!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail