Język

FileChannel.ISeekableByteChannel.Truncate(Int64) Method

Definition

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

Java.Nio.Channels.ISeekableByteChannel? ISeekableByteChannel.Truncate(long size);
abstract member Java.Nio.Channels.ISeekableByteChannel.Truncate : int64 -> Java.Nio.Channels.ISeekableByteChannel
override this.Java.Nio.Channels.ISeekableByteChannel.Truncate : int64 -> Java.Nio.Channels.ISeekableByteChannel

Parameters

size
Int64

The new size, a non-negative byte count

Returns

This channel

Implements

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 APPEND option.

Java reference for java.nio.channels.SeekableByteChannel.truncate.

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