IRandomAccessStream
IRandomAccessStream
IRandomAccessStream
IRandomAccessStream
Interface
Definition
Supports random access of data in input and output streams.
public : interface IRandomAccessStreampublic interface IRandomAccessStreamPublic Interface IRandomAccessStream// You can use this interface in JavaScript.
- Inheritance
-
IRandomAccessStreamIRandomAccessStreamIRandomAccessStreamIRandomAccessStream
- Attributes
| Device family |
Windows 10 (introduced v10.0.10240.0)
|
| API contract |
Windows.Foundation.UniversalApiContract (introduced v1)
|
Inherited Members
Inherited methods
Remarks
For more info, see Quickstart: Reading and writing a file, which shows how to read and write bytes to a file by using a RandomAccessStream. To encode an image by using a stream, see Imaging.
Properties
CanRead CanRead CanRead CanRead
Gets a value that indicates whether the stream can be read from.
public : PlatForm::Boolean CanRead { get; }public bool CanRead { get; }Public ReadOnly Property CanRead As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
True if the stream can be read from. Otherwise, false.
CanWrite CanWrite CanWrite CanWrite
Gets a value that indicates whether the stream can be written to.
public : PlatForm::Boolean CanWrite { get; }public bool CanWrite { get; }Public ReadOnly Property CanWrite As bool// You can use this property in JavaScript.
- Value
- PlatForm::Boolean bool bool bool
True if the stream can be written to. Otherwise, false.
Position Position Position Position
Gets the byte offset of the stream.
public : ulong Position { get; }public ulong Position { get; }Public ReadOnly Property Position As ulong// You can use this property in JavaScript.
- Value
- ulong ulong ulong ulong
The number of bytes from the start of the stream.
Remarks
The initial offset of a IRandomAccessStream is 0.
This offset is affected by both IInputStream and IOutputStream operations.
Methods
CloneStream() CloneStream() CloneStream() CloneStream()
Creates a new instance of a IRandomAccessStream over the same resource as the current stream.
public : IRandomAccessStream CloneStream()public IRandomAccessStream CloneStream()Public Function CloneStream() As IRandomAccessStream// You can use this method in JavaScript.
The new stream. The initial, internal position of the stream is 0.
The internal position and lifetime of this new stream are independent from the position and lifetime of the cloned stream.
GetInputStreamAt(UInt64) GetInputStreamAt(UInt64) GetInputStreamAt(UInt64) GetInputStreamAt(UInt64)
Returns an input stream at a specified location in a stream.
public : IInputStream GetInputStreamAt(unsigned __int64 position)public IInputStream GetInputStreamAt(UInt64 position)Public Function GetInputStreamAt(position As UInt64) As IInputStream// You can use this method in JavaScript.
- position
- unsigned __int64 UInt64 UInt64 UInt64
The location in the stream at which to begin.
The input stream.
GetOutputStreamAt(UInt64) GetOutputStreamAt(UInt64) GetOutputStreamAt(UInt64) GetOutputStreamAt(UInt64)
Returns an output stream at a specified location in a stream.
public : IOutputStream GetOutputStreamAt(unsigned __int64 position)public IOutputStream GetOutputStreamAt(UInt64 position)Public Function GetOutputStreamAt(position As UInt64) As IOutputStream// You can use this method in JavaScript.
- position
- unsigned __int64 UInt64 UInt64 UInt64
The location in the output stream at which to begin.
The output stream.
Seek(UInt64) Seek(UInt64) Seek(UInt64) Seek(UInt64)
Sets the position of the stream to the specified value.
public : void Seek(unsigned __int64 position)public void Seek(UInt64 position)Public Function Seek(position As UInt64) As void// You can use this method in JavaScript.
- position
- unsigned __int64 UInt64 UInt64 UInt64
The new position of the stream.
Remarks
Warning
This method does not check the position to make sure the value is valid for the stream. If the position is invalid for the stream, the ReadAsync and WriteAsync methods will return an error if you call them.