Class UueArchive
名称: Aspose.Zip.Uue 收藏: Aspose.Zip.dll (25.5.0)
此类代表新编码的文件。
public class UueArchive : IArchive, IDisposable, IArchiveFileEntry
Inheritance
Implements
IArchive , IDisposable , IArchiveFileEntry
继承人
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Constructors
UueArchive()
启动一个新的例子 Aspose.Zip.Uue.UueArchive 类准备编码。
public UueArchive()
Examples
下面的例子显示如何重新编码文件。
using (var archive = new UueArchive())
{
archive.SetSource("data.bin");
archive.Save("archive.uue");
}
UueArchive(Stream)
启动一个新的例子 Aspose.Zip.Uue.UueArchive 类准备解码。
public UueArchive(Stream sourceStream)
Parameters
sourceStream
Stream
档案的来源。
Examples
从一个流中打开一个档案,然后将其提取到一个
var ms = new MemoryStream();
using (var archive = new UueArchive(File.OpenRead("archive.001")))
archive.Open().CopyTo(ms);
Remarks
此构建器不解码. 查看 Aspose.Zip.Uue.UueArchive.Open 解压方法。
UueArchive(线条)
启动 Aspose.Zip.Uue.UueArchive 类的新例子。
public UueArchive(string path)
Parameters
path
string
走向档案的路径。
Examples
从文件中按路径打开一个档案,并将其分解到一个
var ms = new MemoryStream();
using (var archive = new UueArchive("archive.uue"))
archive.Open().CopyTo(ms);
Remarks
此构建器不解压. 查看 Aspose.Zip.Uue.UueArchive.Open 解压方法。
Exceptions
path’ is null.
召唤者没有所需的访问许可。
path’ 是空的,只包含白色空间,或包含无效的字符。
拒绝访问 path" 文件。
指定的 path’, 文件名, 或两者都超过系统定义的最大长度. 例如,在基于 Windows 的平台上,路径必须小于 248 个字符, 文件名必须小于 260 个字符。
文件在 path’ 中间包含一个列(:)。
Properties
Name
原始文件的名称。
public string Name { get; }
财产价值
Methods
Dispose()
执行与释放、释放或重新管理未管理资源相关的应用定义任务。
public void Dispose()
Dispose(博尔)
执行与释放、释放或重新管理未管理资源相关的应用定义任务。
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
管理的资源是否要消耗?
Extract(Stream)
将文件提取到提供的流。
public void Extract(Stream destination)
Parameters
destination
Stream
目的地流,必须写作。
Examples
using (var archive = new UueArchive("archive.uue"))
{
archive.Extract(httpResponseStream);
}
Exceptions
destination’ does not support writing.
Extract(线条)
通过路径将文件提取到文件中。
public FileInfo Extract(string path)
Parameters
path
string
路径到目的地文件. 如果文件已经存在,它将被过写。
Returns
获取的文件信息。
Exceptions
path’ is null.
召唤者没有所需的访问许可。
path’ 是空的,只包含白色空间,或包含无效的字符。
拒绝访问 path" 文件。
指定的 path’, 文件名, 或两者都超过系统定义的最大长度. 例如,在基于 Windows 的平台上,路径必须小于 248 个字符, 文件名必须小于 260 个字符。
文件在 path’ 中间包含一个列(:)。
文件未找到。
指定的路径是无效的,例如在无地图驱动器上。
文件已经开放了。
ExtractToDirectory(线条)
将档案内容提取到所提供的目录中。
public void ExtractToDirectory(string destinationDirectory)
Parameters
destinationDirectory
string
路径到目录将提取的文件插入。
Remarks
如果目录不存在,它将被创建。
Exceptions
destinationDirectory’ is null.
例如,在基于 Windows 的平台上,路径必须小于 248 个字符,文件名必须小于 260 个字符。
呼叫者没有必要的许可访问现有目录。
如果目录不存在,路径包含一个列符(:)不属于驱动标签(“C:”)的一部分。
destinationDirectory’ is a zero-length string, contains only white space, or contains one or more invalid characters. You can query for invalid characters by using the System.IO.Path.GetInvalidPathChars method.-or- path is prefixed with, or contains, only a colon character (:).
路径指定的目录是一个文件. -or- 网络名称不明。
Open()
打开存档进行解码,并提供存档内容的流。
public Stream Open()
Returns
代表档案的内容的流。
Examples
使用:Stream decompressed = archive.Open();
.NET 4.0 或更高版本 - 使用 Stream.CopyTo 方法:decompressed.CopyTo(httpResponse.OutputStream)
.NET 3.5 和之前 - 手动复制比特:
byte[] buffer = new byte[8192];
int bytesRead;
while (0 < (bytesRead = decompressed.Read(buffer, 0, buffer.Length)))
fileStream.Write(buffer, 0, bytesRead);
```</p>
#### Remarks
Read from the stream to get the original content of a file. See examples section.
### <a id="Aspose_Zip_Uue_UueArchive_Save_System_IO_Stream_Aspose_Zip_Uue_UueSaveOptions_"></a> Save\(Stream, UueSaveOptions\)
Saves archive to the stream provided.
```csharp
public void Save(Stream outputStream, UueSaveOptions saveOptions = null)
Parameters
outputStream
Stream
目的地流
saveOptions
UueSaveOptions
存储档案的选项。
Examples
将压缩数据写入 http 响应流。
using (var archive = new UueArchive())
{
archive.SetSource(new FileInfo("data.bin"));
archive.Save(httpResponse.OutputStream);
}
Remarks
必须是可写的。
Exceptions
要存档的数据来源尚未提供。
outputStream’ is not writable.
文件源仅是阅读或是目录。
所指定的文件源路径是无效的,例如在无地图驱动器上。
文件源已经开放了。
Save(字符串, UueSaveOptions)
存储存档到提供的目的地文件。
public void Save(string destinationFileName, UueSaveOptions saveOptions = null)
Parameters
destinationFileName
string
要创建档案的路径 如果指定的文件名指向现有文件,则将重写。
saveOptions
UueSaveOptions
存储档案的选项。
Examples
编码数据到文件。
using (var archive = new UueArchive())
{
archive.SetSource(new FileInfo("data.bin"));
archive.Save("data.uue");
}
Exceptions
destinationFileName’ is null.
召唤者没有所需的访问许可。
destinationFileName’ 是空的,只包含白色空间,或包含无效的字符。
拒绝访问 destinationFileName’ 文件。
指定的 destinationFileName’, 文件名, 或两者都超过系统定义的最大长度. 例如,在基于 Windows 的平台上,路径必须小于 248 个字符,文件名必须小于 260 个字符。
文件在 destinationFileName’ 包含字符串中间的一个列(:)。
SetSource(Stream)
将内容编码到档案中。
public void SetSource(Stream source)
Parameters
source
Stream
存档的输入流。
Examples
using (var archive = new UueArchive())
{
archive.SetSource(new MemoryStream(new byte[] { 0x00, 0xFF }));
archive.Save("archive.uue");
}
SetSource(FileInfo)
设置要压缩的内容在档案中。
public void SetSource(FileInfo fileInfo)
Parameters
fileInfo
FileInfo
提到要压缩的文件。
Examples
using (var archive = new UueArchive())
{
archive.SetSource(new FileInfo("data.bin"));
archive.Save("archive.uue");
}
SetSource(线条)
将内容编码到档案中。
public void SetSource(string path)
Parameters
path
string
文件编码的路径。
Examples
using (var archive = new UueArchive())
{
archive.SetSource("data.bin");
archive.Save("archive.uue");
}
Exceptions
path’ is null.
召唤者没有所需的访问许可。
path’ 是空的,只包含白色空间,或包含无效的字符。
拒绝访问 path" 文件。
指定的 path’, 文件名, 或两者都超过系统定义的最大长度. 例如,在基于 Windows 的平台上,路径必须小于 248 个字符, 文件名必须小于 260 个字符。
文件在 path’ 中间包含一个列(:)。