/// <summary> /// Returns an input stream at a specified location in a stream. /// </summary> /// <param name="position">The location in the stream at which to begin.</param> /// <returns>The input stream.</returns> public IInputStream GetInputStreamAt(ulong position) { FileReadStream clonedStream = new FileReadStream(this.originalStream); clonedStream.Seek((long)position, SeekOrigin.Begin); return(clonedStream.AsInputStream()); }
/// <summary> /// Initializes a new instance of the <see cref="FileReadStream"/> class. /// </summary> /// <param name="otherStream">Another FileReadStream instance to clone.</param> internal FileReadStream(FileReadStream otherStream) : this(otherStream.file, otherStream.accessCondition, otherStream.options, otherStream.operationContext) { }
/// <summary> /// Creates a new instance of a IRandomAccessStream over the same resource as the current stream. /// </summary> /// <returns>The new stream. The initial, internal position of the stream is 0.</returns> public IRandomAccessStream CloneStream() { FileReadStream clonedStream = new FileReadStream(this.originalStream); return new FileReadStreamHelper(clonedStream); }
/// <summary> /// Initializes a new instance of the FileReadStreamHelper class. /// </summary> /// <param name="otherStream">An instance of FileReadStream class that this helper should use.</param> private FileReadStreamHelper(FileReadStream otherStream) { this.originalStream = otherStream; this.originalStreamAsInputStream = this.originalStream.AsInputStream(); }
/// <summary> /// Initializes a new instance of the FileReadStreamHelper class. /// </summary> /// <param name="file">File reference to read from</param> /// <param name="accessCondition">An object that represents the access conditions for the file. If null, no condition is used.</param> /// <param name="options">An object that specifies additional options for the request.</param> internal FileReadStreamHelper(CloudFile file, AccessCondition accessCondition, FileRequestOptions options, OperationContext operationContext) { this.originalStream = new FileReadStream(file, accessCondition, options, operationContext); this.originalStreamAsInputStream = this.originalStream.AsInputStream(); }
/// <summary> /// Returns an input stream at a specified location in a stream. /// </summary> /// <param name="position">The location in the stream at which to begin.</param> /// <returns>The input stream.</returns> public IInputStream GetInputStreamAt(ulong position) { FileReadStream clonedStream = new FileReadStream(this.originalStream); clonedStream.Seek((long)position, SeekOrigin.Begin); return clonedStream.AsInputStream(); }
/// <summary> /// Creates a new instance of a IRandomAccessStream over the same resource as the current stream. /// </summary> /// <returns>The new stream. The initial, internal position of the stream is 0.</returns> public IRandomAccessStream CloneStream() { FileReadStream clonedStream = new FileReadStream(this.originalStream); return(new FileReadStreamHelper(clonedStream)); }