Java File and ByteArray or InputStream - please quick help
- by Peter Perhác
I want to use jFuge to play some MIDI music in an applet. There's a class for the MIDI pattern - Pattern - and the only method to load the pattern is from a File. Now, I don't know how applets load files and what not, but I am using a framework (PulpCore) that makes loading assets a simple task. If I need to grab an asset from a ZIP catalogue, I can use the Assets class which provides get() and getAsStream() methods. get() returns the given asset as a ByteArray, the other as an InputStream.
I need jFuge to load the pattern from either ByteArray or InputStream.
In pseudo-code, I would like to do this:
Pattern.load(new File(Assets.get("mymidifile.midi")));
however there is no File constructor that would take a ByteArray. Suggestions, please?