A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://dotnet.github.io/dotNext/api/DotNext.IO.FileWriter.html below:

Class FileWriter | .NEXT

Class FileWriter

Represents the buffered file writer.

Namespace: DotNext.IO Assembly: DotNext.IO.dll Syntax
public class FileWriter : Disposable, IAsyncBinaryWriter, ISupplier<ReadOnlyMemory<byte>, CancellationToken, ValueTask>, IFunctional<Func<ReadOnlyMemory<byte>, CancellationToken, ValueTask>>, IFlushable, IBufferedWriter, IBufferedChannel, IResettable, IDisposable, IBufferWriter<byte>, IDynamicInterfaceCastable
Constructors | Edit this page View Source FileWriter(SafeFileHandle)

Creates a new writer backed by the file.

Declaration
public FileWriter(SafeFileHandle handle)
Parameters Exceptions | Edit this page View Source FileWriter(FileStream)

Creates a new writer backed by the file.

Declaration
public FileWriter(FileStream destination)
Parameters Type Name Description FileStream destination

Writable file stream.

Exceptions Fields | Edit this page View Source handle

Represents the file handle.

Declaration
protected readonly SafeFileHandle handle
Field Value Properties | Edit this page View Source Allocator

Gets buffer allocator.

Declaration
public MemoryAllocator<byte>? Allocator { get; init; }
Property Value | Edit this page View Source Buffer

The remaining part of the internal buffer available for write.

Declaration
public Memory<byte> Buffer { get; }
Property Value | Edit this page View Source FilePosition

Gets or sets the cursor position within the file.

Declaration
public long FilePosition { get; set; }
Property Value Exceptions | Edit this page View Source HasBufferedData

Gets a value indicating that this writer has buffered data.

Declaration
public bool HasBufferedData { get; }
Property Value | Edit this page View Source MaxBufferSize

Gets the maximum size of the internal buffer.

Declaration
public int MaxBufferSize { get; init; }
Property Value | Edit this page View Source WritePosition

Gets write position.

Declaration
public long WritePosition { get; }
Property Value | Edit this page View Source WrittenBuffer

Gets written part of the buffer.

Declaration
public ReadOnlyMemory<byte> WrittenBuffer { get; }
Property Value Methods | Edit this page View Source CopyFromAsync(Stream, long, CancellationToken)

Writes the content from the specified stream.

Declaration
public ValueTask CopyFromAsync(Stream source, long count, CancellationToken token = default)
Parameters Type Name Description Stream source

The stream to read from.

long count

The number of bytes to copy.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description ValueTask

The task representing state of asynchronous execution.

Exceptions | Edit this page View Source CopyFromAsync(Stream, CancellationToken)

Writes the content from the specified stream.

Declaration
public ValueTask CopyFromAsync(Stream input, CancellationToken token = default)
Parameters Type Name Description Stream input

The stream to read from.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description ValueTask

The task representing state of asynchronous execution.

Exceptions | Edit this page View Source Dispose(bool)

Releases managed and unmanaged resources associated with this object.

Declaration
protected override void Dispose(bool disposing)
Parameters Overrides | Edit this page View Source EncodeAsync(ReadOnlyMemory<char>, EncodingContext, LengthFormat?, CancellationToken)

Encodes a block of characters using the specified encoding.

Declaration
public ValueTask<long> EncodeAsync(ReadOnlyMemory<char> chars, EncodingContext context, LengthFormat? lengthFormat, CancellationToken token = default)
Parameters Returns Exceptions | Edit this page View Source FlushToDisk()

Flushes the operating system buffers for the given file to disk.

Declaration
public void FlushToDisk()
Exceptions | Edit this page View Source FormatAsync<T>(T, EncodingContext, LengthFormat?, string?, IFormatProvider?, MemoryAllocator<char>?, CancellationToken)

Encodes formatted value as a set of characters using the specified encoding.

Declaration
public ValueTask<long> FormatAsync<T>(T value, EncodingContext context, LengthFormat? lengthFormat, string? format = null, IFormatProvider? provider = null, MemoryAllocator<char>? allocator = null, CancellationToken token = default) where T : ISpanFormattable
Parameters Type Name Description T value

The type value to be written as string.

EncodingContext context

The context describing encoding of characters.

LengthFormat? lengthFormat

String length encoding format; or null to prevent encoding of string length.

string format

The format of the value.

IFormatProvider provider

The format provider.

MemoryAllocator<char> allocator

Characters buffer allocator.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Parameters Name Description T

The type of formattable value.

Exceptions | Edit this page View Source FormatAsync<T>(T, LengthFormat?, string?, IFormatProvider?, CancellationToken)

Converts the value to UTF-8 encoded characters.

Declaration
public ValueTask<int> FormatAsync<T>(T value, LengthFormat? lengthFormat, string? format = null, IFormatProvider? provider = null, CancellationToken token = default) where T : IUtf8SpanFormattable
Parameters Type Name Description T value

The value to convert.

LengthFormat? lengthFormat

String length encoding format.

string format

The format of the value.

IFormatProvider provider

The format provider.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description ValueTask<int>

The number of written bytes.

Type Parameters Name Description T

The type of the value to convert.

Exceptions | Edit this page View Source Produce(int)

Marks the specified number of bytes in the buffer as produced.

Declaration
public void Produce(int count)
Parameters Type Name Description int count

The number of produced bytes.

Exceptions | Edit this page View Source Reset()

Drops all buffered data.

Declaration | Edit this page View Source TryWrite(ReadOnlySpan<byte>)

Tries to write the data to the internal buffer.

Declaration
public bool TryWrite(ReadOnlySpan<byte> input)
Parameters Returns Type Description bool

true if the internal buffer has enough space to place the data from input; otherwise, false.

| Edit this page View Source Write()

Flushes buffered data to the file.

Declaration Exceptions | Edit this page View Source Write(ReadOnlySpan<byte>)

Writes the data to the file through the buffer.

Declaration
public void Write(ReadOnlySpan<byte> input)
Parameters Exceptions | Edit this page View Source WriteAsync(ReadOnlyMemory<byte>, LengthFormat, CancellationToken)

Encodes a block of memory, optionally prefixed with the length encoded as a sequence of bytes according to the specified format.

Declaration
public ValueTask WriteAsync(ReadOnlyMemory<byte> input, LengthFormat lengthFormat, CancellationToken token = default)
Parameters Returns Type Description ValueTask

The task representing state of asynchronous execution.

Exceptions | Edit this page View Source WriteAsync(ReadOnlyMemory<byte>, CancellationToken)

Writes the data to the underlying storage through the buffer.

Declaration
public ValueTask WriteAsync(ReadOnlyMemory<byte> input, CancellationToken token = default)
Parameters Returns Type Description ValueTask

The task representing asynchronous result.

Exceptions | Edit this page View Source WriteAsync(CancellationToken)

Flushes buffered data to the underlying storage.

Declaration
public ValueTask WriteAsync(CancellationToken token = default)
Parameters Type Name Description CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description ValueTask

The task representing asynchronous result.

Exceptions | Edit this page View Source WriteAsync<T>(T, CancellationToken)

Encodes formattable value as a set of bytes.

Declaration
public ValueTask WriteAsync<T>(T value, CancellationToken token = default) where T : IBinaryFormattable<T>
Parameters Type Name Description T value

The value to be written as a sequence of bytes.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description ValueTask

The task representing state of asynchronous execution.

Type Parameters Name Description T

The type of formattable value.

Exceptions | Edit this page View Source WriteBigEndianAsync<T>(T, CancellationToken)

Writes integer value in big-endian format.

Declaration
public ValueTask WriteBigEndianAsync<T>(T value, CancellationToken token = default) where T : IBinaryInteger<T>
Parameters Type Name Description T value

The value to be written in big-endian format.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description ValueTask

The task representing state of asynchronous execution.

Type Parameters Name Description T

The integer type.

Exceptions | Edit this page View Source WriteLittleEndianAsync<T>(T, CancellationToken)

Writes integer value in little-endian format.

Declaration
public ValueTask WriteLittleEndianAsync<T>(T value, CancellationToken token = default) where T : IBinaryInteger<T>
Parameters Type Name Description T value

The value to be written in little-endian format.

CancellationToken token

The token that can be used to cancel the operation.

Returns Type Description ValueTask

The task representing state of asynchronous execution.

Type Parameters Name Description T

The integer type.

Exceptions Implements Extension Methods

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4