byte[] bytes = StreamToBytes(stream); InMemoryRandomAccessStream memoryStream = new InMemoryRandomAccessStream(); DataWriter datawriter = new DataWriter(memoryStream.GetOutputStreamAt(0)); datawriter.WriteBytes(bytes); await datawriter.StoreAsync();
var randomAccessStream = new InMemoryRandomAccessStream(); var outputStream = randomAccessStream.GetOutputStreamAt(0); await RandomAccessStream.CopyAsync(stream.AsInputStream(), outputStream);
Stream stream=WindowsRuntimeStreamExtensions.AsStreamForRead(randomStream.GetInputStreamAt(0));
Stream stream = WindowsRuntimeBufferExtensions.AsStream(buffer);
MemoryStream memoryStream = new MemoryStream(); if (stream != null) { byte[] bytes = ReadFully(stream); if (bytes != null) { var binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(bytes); } } IBuffer buffer=WindowsRuntimeBufferExtensions.GetWindowsRuntimeBuffer(memoryStream,0,(int)memoryStream.Length);
byte[] bytes=WindowsRuntimeBufferExtensions.ToArray(buffer,0,(int)buffer.Length);
WindowsRuntimeBufferExtensions.AsBuffer(bytes,0,bytes.Length);
InMemoryRandomAccessStream inStream = new InMemoryRandomAccessStream(); DataWriter datawriter = new DataWriter(inStream.GetOutputStreamAt(0)); datawriter.WriteBuffer(buffer,0,buffer.Length); await datawriter.StoreAsync();
Stream stream=WindowsRuntimeStreamExtensions.AsStreamForRead(randomStream.GetInputStreamAt(0)); MemoryStream memoryStream = new MemoryStream(); if (stream != null) { byte[] bytes = ReadFully(stream); if (bytes != null) { var binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(bytes); } } IBuffer buffer=WindowsRuntimeBufferExtensions.GetWindowsRuntimeBuffer(memoryStream,0,(int)memoryStream.Length);
FileInputStream inputStream=randomStream.GetInputStreamAt(0) as FileInputStream;
FileOutputStream outStream= randomStream.GetOutputStreamAt(0) as FileOutputStream;
public static byte[] ConvertStreamTobyte(Stream input) { byte[] buffer = new byte[16 * 1024]; using (MemoryStream ms = new MemoryStream()) { int read; while ((read = input.Read(buffer, 0, buffer.Length)) > 0) { ms.Write(buffer, 0, read); } return ms.ToArray(); } }
public Stream BytesToStream(byte[] bytes) { Stream stream = new MemoryStream(bytes); return stream; }
public static MemoryStream ConvertStreamToMemoryStream(Stream stream) { MemoryStream memoryStream = new MemoryStream(); if (stream != null) { byte[] buffer = ReadFully(stream); if (buffer != null) { var binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write(buffer); } } return memoryStream; }