Muokkaa

Jaa


TarWriter.WriteEntryAsync Method

Definition

Overloads

WriteEntryAsync(TarEntry, CancellationToken)

Asynchronously writes the specified entry into the archive stream.

WriteEntryAsync(String, String, CancellationToken)

Asynchronously writes the specified file into the archive stream as a tar entry.

WriteEntryAsync(TarEntry, CancellationToken)

Source:
TarWriter.cs
Source:
TarWriter.cs
Source:
TarWriter.cs

Asynchronously writes the specified entry into the archive stream.

public System.Threading.Tasks.Task WriteEntryAsync (System.Formats.Tar.TarEntry entry, System.Threading.CancellationToken cancellationToken = default);
member this.WriteEntryAsync : System.Formats.Tar.TarEntry * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WriteEntryAsync (entry As TarEntry, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

entry
TarEntry

The tar entry to write.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous write operation.

Exceptions

The entry type is HardLink or SymbolicLink and the LinkName is null or empty.

The archive stream is disposed.

entry is null.

An I/O problem occurred.

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

Before writing an entry to the archive, if you wrote data into the entry's DataStream, make sure to rewind it to the desired start position.

These are the entry types supported for writing on each format:

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WriteEntry(TarEntry).

Applies to

WriteEntryAsync(String, String, CancellationToken)

Source:
TarWriter.cs
Source:
TarWriter.cs
Source:
TarWriter.cs

Asynchronously writes the specified file into the archive stream as a tar entry.

public System.Threading.Tasks.Task WriteEntryAsync (string fileName, string? entryName, System.Threading.CancellationToken cancellationToken = default);
member this.WriteEntryAsync : string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function WriteEntryAsync (fileName As String, entryName As String, Optional cancellationToken As CancellationToken = Nothing) As Task

Parameters

fileName
String

The path to the file to write to the archive.

entryName
String

The name of the file as it should be represented in the archive. It should include the optional relative path and the filename.

cancellationToken
CancellationToken

The token to monitor for cancellation requests. The default value is None.

Returns

A task that represents the asynchronous write operation.

Exceptions

The archive stream is disposed.

fileName or entryName is null or empty.

An I/O problem occurred.

The cancellation token was canceled. This exception is stored into the returned task.

Remarks

This method stores in the task it returns all non-usage exceptions that the method's synchronous counterpart can throw. If an exception is stored into the returned task, that exception will be thrown when the task is awaited. Usage exceptions, such as ArgumentException, are still thrown synchronously. For the stored exceptions, see the exceptions thrown by WriteEntry(String, String).

Applies to