Java.Nio.Channels.FileChannel.Truncate Method
Truncates the file underlying this channel to a given size.

Syntax

[Android.Runtime.Register("truncate", "(J)Ljava/nio/channels/FileChannel;", "GetTruncate_JHandler")]
public abstract FileChannel Truncate (long size)

Parameters

size
the maximum size of the underlying file.

Returns

Documentation for this section has not yet been entered.

Exceptions

TypeReason
Java.Lang.IllegalArgumentExceptionif the requested size is negative.
Java.Nio.Channels.ClosedChannelExceptionif this channel is closed.
Java.Nio.Channels.NonWritableChannelExceptionif the channel cannot be written to.
Java.IO.IOExceptionif another I/O error occurs.

Remarks

Truncates the file underlying this channel to a given size. Any bytes beyond the given size are removed from the file. If there are no bytes beyond the given size then the file contents are unmodified.

If the file position is currently greater than the given size, then it is set to the new size.

[Android Documentation]

Requirements

Namespace: Java.Nio.Channels
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1