Search the archives!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Shortening file length on RandomAccessFile
- From: kreilede@xxxxxxxxxxxxxxxxxxxxxxxx (Juergen Kreileder)
- Subject: Shortening file length on RandomAccessFile
- Date: 31 Aug 1999 22:48:13 +0200
>>>>> Jeff Sturm writes:
Jeff> There is no portable way to shorten a file. On many
Jeff> platforms you must resort to recreating the file, even if
Jeff> you code in C.
This is not true, nearly all UNIX implementations have truncate and
ftruncate (see the Single UNIX Specification). And it seems to be
possible on Windows too, at least JDKs >= 1.2 have a
RandomAccessFile.setLength() method.
Jeff> Andy Wiese wrote:
>>
>> Is there a way that I can reduce the length of a RandomAccessFile? I am
>> using RandomAccessFile to implement a small database...when the total
>> stored data shrinks, I would like to reduce the length of the file. I am
>> trying to avoid writing out a new file because of cross-platform issues
>> (it needs to run well on the Mac, and if I recreate the file I lose the
>> resource fork).
Juergen
--
Juergen Kreileder, Blackdown Java-Linux Porting Team
http://www.blackdown.org/java-linux.html
- References:
- Shortening file length on RandomAccessFile
- From: Andy Wiese
- Shortening file length on RandomAccessFile
- From: Jeff Sturm
- Shortening file length on RandomAccessFile
- Prev by Date: Shortening file length on RandomAccessFile
- Next by Date: Help! How can a servlet find out the user's port?
- Previous by thread: Shortening file length on RandomAccessFile
- Next by thread: Downloading jars
- Index(es):