|
|
@@ -5,9 +5,9 @@ using System.IO.Compression;
|
|
|
namespace Renci.SshNet.Compression
|
|
|
{
|
|
|
/// <summary>
|
|
|
- /// Represents "zlib" compression implementation.
|
|
|
+ /// Represents the "zlib" compression algorithm.
|
|
|
/// </summary>
|
|
|
- internal class Zlib : Compressor
|
|
|
+ public class Zlib : Compressor
|
|
|
{
|
|
|
private readonly ZLibStream _compressor;
|
|
|
private readonly ZLibStream _decompressor;
|
|
|
@@ -15,11 +15,20 @@ namespace Renci.SshNet.Compression
|
|
|
private MemoryStream _decompressorStream;
|
|
|
private bool _isDisposed;
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Initializes a new instance of the <see cref="Zlib"/> class.
|
|
|
+ /// </summary>
|
|
|
public Zlib()
|
|
|
: this(delayedCompression: false)
|
|
|
{
|
|
|
}
|
|
|
|
|
|
+ /// <summary>
|
|
|
+ /// Initializes a new instance of the <see cref="Zlib"/> class.
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="delayedCompression">
|
|
|
+ /// <inheritdoc cref="Compressor(bool)" path="/param[@name='delayedCompression']"/>
|
|
|
+ /// </param>
|
|
|
protected Zlib(bool delayedCompression)
|
|
|
: base(delayedCompression)
|
|
|
{
|
|
|
@@ -30,14 +39,13 @@ namespace Renci.SshNet.Compression
|
|
|
_decompressor = new ZLibStream(_decompressorStream, CompressionMode.Decompress);
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// Gets algorithm name.
|
|
|
- /// </summary>
|
|
|
+ /// <inheritdoc/>
|
|
|
public override string Name
|
|
|
{
|
|
|
get { return "zlib"; }
|
|
|
}
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
protected override byte[] CompressCore(byte[] data, int offset, int length)
|
|
|
{
|
|
|
_compressorStream.SetLength(0);
|
|
|
@@ -48,6 +56,7 @@ namespace Renci.SshNet.Compression
|
|
|
return _compressorStream.ToArray();
|
|
|
}
|
|
|
|
|
|
+ /// <inheritdoc/>
|
|
|
protected override byte[] DecompressCore(byte[] data, int offset, int length)
|
|
|
{
|
|
|
_decompressorStream.Write(data, offset, length);
|