[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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user