[multiple changes]

2004-07-17  Mark Wielaard  <mark@klomp.org>

	* gnu/java/nio/channels/FileChannelImpl.java (truncate): Only truncate
	when size is smaller.
	* java/io/RandomAccessFile.java (setLength): Use truncate for
	shrinking the file and seek plus write for expanding the file.

2004-07-17  Michael Koch  <konqueror@gmx.de>

	* gnu/java/nio/channels/natFileChannelPosix.cc
	(implTruncate): Always save current position. Only reposition file
	pointer to where we started if not beyond new lenght. Reposition file
	pointer to file length if it points beyond the end of file.

From-SVN: r84868
This commit is contained in:
Michael Koch 2004-07-17 13:46:02 +00:00
parent 3e25b3a8f8
commit baa61e09ef
4 changed files with 42 additions and 9 deletions

View file

@ -422,7 +422,9 @@ public final class FileChannelImpl extends FileChannel
if ((mode & WRITE) == 0)
throw new NonWritableChannelException ();
implTruncate (size);
if (size < size ())
implTruncate (size);
return this;
}
}