mirror of
https://github.com/ICDSystems/ICD.Common.Utils.git
synced 2026-02-16 05:05:05 +00:00
Created S# .sln and moved project to src folder
This commit is contained in:
41
ICD.Common/Utils/IO/IcdStreamReader.cs
Normal file
41
ICD.Common/Utils/IO/IcdStreamReader.cs
Normal file
@@ -0,0 +1,41 @@
|
||||
using System;
|
||||
#if SIMPLSHARP
|
||||
using Crestron.SimplSharp.CrestronIO;
|
||||
#elif STANDARD
|
||||
using System.IO;
|
||||
#endif
|
||||
|
||||
namespace ICD.Common.Utils.IO
|
||||
{
|
||||
public sealed class IcdStreamReader : IDisposable
|
||||
{
|
||||
private readonly StreamReader m_StreamReader;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor.
|
||||
/// </summary>
|
||||
/// <param name="memoryStream"></param>
|
||||
public IcdStreamReader(IcdMemoryStream memoryStream)
|
||||
{
|
||||
if (memoryStream == null)
|
||||
throw new ArgumentNullException("memoryStream");
|
||||
|
||||
m_StreamReader = new StreamReader(memoryStream.WrappedMemoryStream);
|
||||
}
|
||||
|
||||
~IcdStreamReader()
|
||||
{
|
||||
Dispose();
|
||||
}
|
||||
|
||||
public string ReadToEnd()
|
||||
{
|
||||
return m_StreamReader.ReadToEnd();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
m_StreamReader.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user