AiKismet.SearchableStream 0.1.1

dotnet add package AiKismet.SearchableStream --version 0.1.1
NuGet\Install-Package AiKismet.SearchableStream -Version 0.1.1
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="AiKismet.SearchableStream" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add AiKismet.SearchableStream --version 0.1.1
#r "nuget: AiKismet.SearchableStream, 0.1.1"
#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 AiKismet.SearchableStream as a Cake Addin
#addin nuget:?package=AiKismet.SearchableStream&version=0.1.1

// Install AiKismet.SearchableStream as a Cake Tool
#tool nuget:?package=AiKismet.SearchableStream&version=0.1.1

AiKismet's SearchableStream

A System.IO.Stream wrapper that adds some useful search and read abilities.

Example using SearchableStringStream

Default encoding for SearchableStringStream is ASCII. You can set a different encoding type in the constructor ``new SearchableStringStream(Stream stream, Encoding encoding)```. As an example, if you have a pdf (strings are usually ASCII encoded) you might want to first find the "trailer" of the file that's indicated by that as a string in the Byte data. The code below finds the last position of "trailer" and then renders three lines of that trailer.

using (var fs = File.Open(@"C:\temp\test.pdf", FileMode.Open, FileAccess.Read))
using (var samplePdfStringStream = new SearchableStringStream(fs))
{
    var positionOfTrailer = samplePdfStringStream.LastIndexOf("trailer");
    samplePdfStringStream.Position--; // Set position to one before to include "t" of trailer.
    var threeLinesOfTrailer = samplePdfStringStream.ReadLines(3);
    Console.WriteLine($"Position of trailer in the pdf is: {positionOfTrailer}");
    Console.WriteLine("\n\nThe first 3 lines of the trailer are:\n");
    Console.WriteLine(threeLinesOfTrailer);
}

Possible output output

trailer
<</Size 11677/Root 1 0 R/Info 1943 0 R/ID[<F2D672E0489DBF46AEF8400DCC1DB98E><F2D672E0489DBF46AEF8400DCC1DB98E>] /Prev 12539514/XRefStm 12512836>>
startxref
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.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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
0.1.1 674 7/3/2019
0.1.0 590 7/3/2019

First release that includes a workable