I've been given the task to write a program in java that is going to capture audio from a flash-application on the web. The flash-application is a music application where you can make your own song and then click a button to make it into a sound-file. The flash-application is done so I gotta figure out the java-code that is gonna produce the sound-file.

I'm thinking of using the Java Sound API (I've tried to read audiostreams with it and creating new sound-files with it successfully). I've been told that flash is capable of sending byte arrays so my idea is to create a java servlet that recieves a byte array from the flash application and then use the Java Sound API to create the file.

The problems is that I've never done anything like this and I'm a bit worried that my thinking is all gone bad and that my idea will never work. So I thought I'd ask you boys and girls if you got any suggestions? Is my idea all wrong? How would you have done it? Is this impossible?

Any help would be very much appreciated! Thanks!