Metro各种流转换

Ibuffer转byte[] 



byte[] bytes=WindowsRuntimeBufferExtensions.ToArray(buffer,0,(int)buffer.Length); 



Byte[]转Ibuffer 



WindowsRuntimeBufferExtensions.AsBuffer(bytes,0,bytes.Length); 

IRandomAccessStream Stream

Stream stream=WindowsRuntimeStreamExtensions.AsStreamForRead(randomStream.GetInputStreamAt(0));
 

IbufferStream

Stream stream = WindowsRuntimeBufferExtensions.AsStream(buffer);
 
 
Byte Stream
 
Stream stream = new MemoryStream(bytes);
 
 
IRandomAccessStream FileInputStream
 
FileInputStream inputStream=randomStream.GetInputStreamAt(0) as FileInputStream;
 
 
IRandomAccessStream FileOutputStream
 
FileOutputStream outStream= randomStream.GetOutputStreamAt(0) as FileOutputStream;
 

 

你可能感兴趣的:(metro)