Share via


ISeekableByteChannel.Truncate(Int64) Method

Definition

Truncates the entity, to which this channel is connected, to the given size.

[Android.Runtime.Register("truncate", "(J)Ljava/nio/channels/SeekableByteChannel;", "GetTruncate_JHandler:Java.Nio.Channels.ISeekableByteChannelInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)]
public Java.Nio.Channels.ISeekableByteChannel? Truncate (long size);
[<Android.Runtime.Register("truncate", "(J)Ljava/nio/channels/SeekableByteChannel;", "GetTruncate_JHandler:Java.Nio.Channels.ISeekableByteChannelInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=24)>]
abstract member Truncate : int64 -> Java.Nio.Channels.ISeekableByteChannel

Parameters

size
Int64

The new size, a non-negative byte count

Returns

This channel

Attributes

Remarks

Truncates the entity, to which this channel is connected, to the given size.

If the given size is less than the current size then the entity is truncated, discarding any bytes beyond the new end. If the given size is greater than or equal to the current size then the entity is not modified. In either case, if the current position is greater than the given size then it is set to that size.

An implementation of this interface may prohibit truncation when connected to an entity, typically a file, opened with the java.nio.file.StandardOpenOption#APPEND APPEND option.

Java documentation for java.nio.channels.SeekableByteChannel.truncate(long).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to