File size: 2,527 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
using System.Collections;
using System.IO;
#nullable enable
namespace System.Management.Automation.Provider
{
#region IContentReader
/// <summary>
/// A Cmdlet provider that implements the IContentCmdletProvider interface must provide an
/// object that implements this interface when GetContentReader() is called.
///
/// The interface allows for reading content from an item.
/// </summary>
public interface IContentReader : IDisposable
{
/// <summary>
/// Reads the content from the item.
/// </summary>
/// <param name="readCount">
/// The number of "blocks" of data to be read from the item.
/// </param>
/// <returns>
/// An array of the blocks of data read from the item.
/// </returns>
/// <remarks>
/// A "block" of content is provider specific. For the file system
/// a "block" may be considered a line of text, a byte, a character, or delimited string.
///
/// The implementation of this method should break the content down into meaningful blocks
/// that the user may want to manipulate individually. The number of blocks to return is
/// indicated by the <paramref name="readCount"/> parameter.
/// </remarks>
IList Read(long readCount);
/// <summary>
/// Moves the current "block" to be read to a position relative to a place
/// in the reader.
/// </summary>
/// <param name="offset">
/// An offset of the number of blocks to seek from the origin.
/// </param>
/// <param name="origin">
/// The place in the stream to start the seek from.
/// </param>
/// <remarks>
/// The implementation of this method moves the content reader <paramref name="offset"/>
/// number of blocks from the specified <paramref name="origin"/>. See <see cref="IContentReader.Read"/>
/// for a description of what a block is.
/// </remarks>
void Seek(long offset, SeekOrigin origin);
/// <summary>
/// Closes the reader. Further reads should fail if the reader
/// has been closed.
/// </summary>
/// <remarks>
/// The implementation of this method should close any resources held open by the
/// reader.
/// </remarks>
void Close();
}
#endregion IContentReader
}
|