Load texture frum byte[]

hey there,

i obtain an image file as byte[] from a service. now i want do directly make a texture out of it without having to write the byte[] to the filesystem and then load it as a texture from there.

i do not know the width and height of the image, nor its format. i just have an image file (in a file system sense) as a byte[] in memory.

any suggestions?

thanks in advance,


If the byte[] is in any image format jME is able to load you can just wrap the array in a ByteArrayInputStream and load the image from that.

i cannot find an overloaded method of TextureManager.loadTexture() that takes a stream !?

You can use loadImage instead. See TextureManager's source code for how to build a Texture from that.