Skip to content

Commit 29f943a

Browse files
committed
Remove ZLib APIs
This code is not being called by ML.NET, and it was not intended to be public API. Removing. Fix dotnet#2249
1 parent 620ca89 commit 29f943a

File tree

5 files changed

+0
-670
lines changed

5 files changed

+0
-670
lines changed

src/Microsoft.ML.Data/DataLoadSave/Binary/CompressionKind.cs

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using System;
65
using System.IO;
76
using System.IO.Compression;
8-
using Microsoft.ML.CommandLine;
9-
using Microsoft.ML.Data.IO.Zlib;
107
using Microsoft.ML.Internal.Utilities;
118

129
namespace Microsoft.ML.Data.IO
@@ -65,107 +62,4 @@ public static Stream DecompressStream(this CompressionKind compression, Stream s
6562
}
6663
}
6764
}
68-
69-
/// <summary>
70-
/// A loadable class to parameterize compression.
71-
/// </summary>
72-
public abstract class Compression
73-
{
74-
public abstract CompressionKind Kind { get; }
75-
76-
/// <summary>
77-
/// Generate an appropriate wrapping compressing stream for the codec. This
78-
/// stream will be closable and disposable, without closing or disposing of
79-
/// the passed in stream. The scheme for compression is parameterized by the
80-
/// <see cref="Compression"/> instance.
81-
/// </summary>
82-
/// <param name="stream">The stream to which compressed data will be written</param>
83-
/// <returns>A stream to which the user can write uncompressed data</returns>
84-
public virtual Stream Open(Stream stream)
85-
{
86-
return Kind.CompressStream(stream);
87-
}
88-
89-
// Named with "Impl" suffix since otherwise it was difficult to disambiguate
90-
// with other identifiers.
91-
public sealed class NoneImpl : Compression
92-
{
93-
public override CompressionKind Kind { get { return CompressionKind.None; } }
94-
}
95-
96-
public sealed class ZlibImpl : Compression
97-
{
98-
public abstract class ArgumentsBase
99-
{
100-
[Argument(ArgumentType.AtMostOnce, HelpText = "Level of compression from 0 to 9", ShortName = "c")]
101-
102-
public int? CompressionLevel = 9;
103-
104-
[Argument(ArgumentType.AtMostOnce, HelpText = "Window bits from 8 to 15, higher values enable more useful run length encodings", ShortName = "w")]
105-
public int WindowBits = 15;
106-
107-
[Argument(ArgumentType.AtMostOnce, HelpText = "Level of memory from 1 to 9, with higher values using more memory but enabling better, faster compression", ShortName = "m")]
108-
public int MemoryLevel = 9;
109-
110-
[Argument(ArgumentType.AtMostOnce, HelpText = "Compression strategy to employ", ShortName = "s")]
111-
public Constants.Strategy Strategy = Constants.Strategy.DefaultStrategy;
112-
}
113-
114-
public sealed class DeflateArguments : ArgumentsBase
115-
{
116-
}
117-
118-
public sealed class ZlibArguments : ArgumentsBase
119-
{
120-
}
121-
122-
public override CompressionKind Kind
123-
{
124-
get { return CompressionKind.Deflate; }
125-
}
126-
127-
private readonly int _windowBits;
128-
private readonly Constants.Level _level;
129-
private readonly bool _isDeflate;
130-
private readonly int _memoryLevel;
131-
private readonly Constants.Strategy _strategy;
132-
133-
private ZlibImpl(ArgumentsBase args, bool isDeflate)
134-
{
135-
Contracts.CheckUserArg(args.CompressionLevel == null ||
136-
(0 <= args.CompressionLevel && args.CompressionLevel <= 9),
137-
nameof(args.CompressionLevel), "Must be in range 0 to 9 or null");
138-
Contracts.CheckUserArg(8 <= args.WindowBits && args.WindowBits <= 15, nameof(args.WindowBits), "Must be in range 8 to 15");
139-
Contracts.CheckUserArg(1 <= args.MemoryLevel && args.MemoryLevel <= 9, nameof(args.MemoryLevel), "Must be in range 1 to 9");
140-
Contracts.CheckUserArg(Enum.IsDefined(typeof(Constants.Strategy), args.Strategy), nameof(args.Strategy), "Value was not defined");
141-
142-
if (args.CompressionLevel == null)
143-
_level = Constants.Level.DefaultCompression;
144-
else
145-
_level = (Constants.Level)args.CompressionLevel;
146-
Contracts.Assert(Enum.IsDefined(typeof(Constants.Level), _level));
147-
_windowBits = args.WindowBits;
148-
_isDeflate = isDeflate;
149-
_memoryLevel = args.MemoryLevel;
150-
_strategy = args.Strategy;
151-
}
152-
153-
public ZlibImpl(DeflateArguments args)
154-
: this(args, isDeflate: true)
155-
{
156-
Contracts.Assert(Kind == CompressionKind.Deflate);
157-
}
158-
159-
public ZlibImpl(ZlibArguments args)
160-
: this(args, isDeflate: false)
161-
{
162-
// Contracts.Assert(Kind == CompressionKind.Zlib);
163-
}
164-
165-
public override Stream Open(Stream stream)
166-
{
167-
return new ZDeflateStream(stream, _level, _strategy, _memoryLevel, !_isDeflate, _windowBits);
168-
}
169-
}
170-
}
17165
}

src/Microsoft.ML.Data/DataLoadSave/Binary/Zlib/Constants.cs

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)