Java File and ByteArray or InputStream - please quick help
Posted
by Peter Perhác
on Stack Overflow
See other posts from Stack Overflow
or by Peter Perhác
Published on 2010-04-24T10:48:06Z
Indexed on
2010/04/24
10:53 UTC
Read the original article
Hit count: 390
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?
© Stack Overflow or respective owner