Getting an array of bytes out of Windows::Storage::Streams::IBuffer

You can use IBufferByteAccess, through exotic COM casts: byte* GetPointerToPixelData(IBuffer^ buffer) { // Cast to Object^, then to its underlying IInspectable interface. Object^ obj = buffer; ComPtr<IInspectable> insp(reinterpret_cast<IInspectable*>(obj)); // Query the IBufferByteAccess interface. ComPtr<IBufferByteAccess> bufferByteAccess; ThrowIfFailed(insp.As(&bufferByteAccess)); // Retrieve the buffer data. byte* pixels = nullptr; ThrowIfFailed(bufferByteAccess->Buffer(&pixels)); return pixels; } Code sample copied from http://cm-bloggers.blogspot.fi/2012/09/accessing-image-pixel-data-in-ccx.html

Using ServletOutputStream to write very large files in a Java servlet without memory issues

The average decent servletcontainer itself flushes the stream by default every ~2KB. You should really not have the need to explicitly call flush() on the OutputStream of the HttpServletResponse at intervals when sequentially streaming data from the one and same source. In for example Tomcat (and Websphere!) this is configureable as bufferSize attribute of the … Read more

How to stream mp3 using pure Java

As Mario says, JMF – Java Media Framework is a good starting point. What Mario does not say is that Sun killed MP3 support since 2.1.1b as detailed in the “My Lost Streaming MP3 Article” blog entry. So you need to add a plugin to support MP3: the JMF Formats list does mention MP3 (under … Read more

How can I split (copy) a Stream in .NET?

I have made a SplitStream available on github and NuGet. It goes like this. using (var inputSplitStream = new ReadableSplitStream(inputSourceStream)) using (var inputFileStream = inputSplitStream.GetForwardReadOnlyStream()) using (var outputFileStream = File.OpenWrite(“MyFileOnAnyFilestore.bin”)) using (var inputSha1Stream = inputSplitStream.GetForwardReadOnlyStream()) using (var outputSha1Stream = SHA1.Create()) { inputSplitStream.StartReadAhead(); Parallel.Invoke( () => { var bytes = outputSha1Stream.ComputeHash(inputSha1Stream); var checksumSha1 = string.Join(“”, bytes.Select(x … Read more