Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The IRandomAccessStream has a method called GetInputStreamAt <a href="http://msdn.microsoft.com/en-US/library/windows/apps/windows.storage.streams.irandomaccessstream" rel="nofollow">http://msdn.microsoft.com/en-US/library/windows/apps/windows.storage.streams.irandomaccessstream</a></p> <pre><code>IInputStream inputStream = stream.GetInputStreamAt(0); </code></pre> <p>This gets you an IInputStream. </p> <p>The IInputStream interface defines just one method, ReadAsync, which lets you read bytes into an IBuffer object. Windows.Storage.Stream also includes a DataReader class that you create based on an IInputStream object and then read numerous .NET objects from the stream as well as arrays of bytes. <a href="http://www.charlespetzold.com/blog/2011/11/080203.html" rel="nofollow">http://www.charlespetzold.com/blog/2011/11/080203.html</a> , <a href="http://msdn.microsoft.com/library/windows/apps/BR208119" rel="nofollow">http://msdn.microsoft.com/library/windows/apps/BR208119</a></p> <pre><code>using (var stream = new InMemoryRandomAccessStream()) { // for example, render pdf page var pdfPage = document.GetPage((uint)i); await pdfPage.RenderToStreamAsync(stream); // then, write page to file using (var reader = new DataReader(stream)) { await reader.LoadAsync((uint)stream.Size); var buffer = new byte[(int)stream.Size]; reader.ReadBytes(buffer); await Windows.Storage.FileIO.WriteBytesAsync(file, buffer); } } </code></pre> <p>now you have a buffer containing all the read bytes.</p> <p>you can now save this buffer to a file <a href="http://blog.jerrynixon.com/2012/06/windows-8-how-to-read-files-in-winrt.html" rel="nofollow">http://blog.jerrynixon.com/2012/06/windows-8-how-to-read-files-in-winrt.html</a></p> <pre><code>var file = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFileAsync("MyWav.wav", Windows.Storage.CreationCollisionOption.ReplaceExisting); await Windows.Storage.FileIO.WriteBytesAsync(file, buffer); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload