ConstantStream 1.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package ConstantStream --version 1.0.9
NuGet\Install-Package ConstantStream -Version 1.0.9
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ConstantStream" Version="1.0.9" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ConstantStream --version 1.0.9
#r "nuget: ConstantStream, 1.0.9"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ConstantStream as a Cake Addin
#addin nuget:?package=ConstantStream&version=1.0.9

// Install ConstantStream as a Cake Tool
#tool nuget:?package=ConstantStream&version=1.0.9

ConstantStream

NuGet version (ConstanStream)

A collection of fake streams for testing purposes.

Types

The library have tree stream types:

  • ConstantByteStream: A fake stream that generate a finite set of the same bytes.
  • ConstantStrideStream: A fake stream that generate a byte stride in a loop.
  • TimedStream: A fake constant byte stream that waits in determined positions.

For example:

// The constant byte stream
var cbs = ConstantByteStream(5, (byte) 'A'); 
(new StreamReader(cbs).ReadToEnd() // Should return  "AAAAA"

// The constant stride stream
ConstantStrideStream(10, Encoding.UTF8.GetBytes("ABC")); // Should read as "ABCABCABCA"

// The TimedStream
var timedStream = new TimedStream(1024, (byte)'c'); // Just like a constant byte stream

timedStream.Delays.Add(0, TimeSpan.FromMilliseconds(200)); // add a wait in position 0 of 200 ms
timedStream.Delays.Add(15, TimeSpan.FromMilliseconds(250)); // add a wait in position 15 of 250 ms
timedStream.Delays.Add(1000, TimeSpan.FromMinutes(1)); // add a wait in position 1000 of 1 min
// the timedStream should take about 1 minute + 450 ms + reading overhead(ms) to read in total

Usage

using ConstantStream;

// Creates a 1 Mb stream of zeroes.
var zeroesStream = new ConstantByteStream(1024*1024, (byte)0);

// Creates a 1 Gb stream full of 's'.
var sStream = new ConstantByteStream(1024*1024*1024, (byte)'s');

// Handy factory methods (From*) for ConstantByteStream
var zeroesStreamEasy = ConstantByteStream.FromZeroes(1024*1024); // 1 Mb of zeroes
var onesStreamEasy = ConstantByteStream.FromOnes(1024); // 1 Kb of ones
var onesStreamEasy = ConstantByteStream.FromFromA(42); // 42 bytes of 'a'


// Handy factory methods (From*) for ConstantStrideStream
var zeroesStreamEasy = ConstantStrideStream.FromNumbers(1024*1024); // 01234567890123456... numbers from 0 to 9 in a loop
var zeroesStreamEasy = ConstantStrideStream.FromAlphabet(1024); // abcdefghijkl.... alphabet in a loop

Info

The Stream doesnt have a base stream. Its a fake generator and provide a simple Stream that generates large amounts of data. It can be used with stream readers like TextReader, copyTo(file), HttpBody, crypto readers, and compression readers.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.17 256 2/13/2023
1.0.16 214 2/13/2023
1.0.15 220 2/13/2023
1.0.14 224 2/13/2023
1.0.13 209 2/13/2023
1.0.12 210 2/13/2023
1.0.11 217 2/13/2023
1.0.10 207 2/13/2023
1.0.9 251 1/31/2023
1.0.8 241 1/31/2023
1.0.7 240 1/31/2023
1.0.6 245 1/31/2023
1.0.5 248 1/31/2023
1.0.4 293 1/31/2023
1.0.3 294 1/30/2023
1.0.2 294 1/30/2023
1.0.1 274 1/30/2023
1.0.0 267 1/30/2023