public static byte[] readData(byte[] store, int bytes, InputStream is) throws IOException {
        for (int i = 0; i < bytes; i++) {
            store[i] = (byte)is.read();
        }
        return store;
    }
Properly reads in data from the given stream until the specified number
of bytes have been read.

@param store
           the byte array to store in. Array length must be greater than bytes param.
@param bytes
           the number of bytes to read.
@param is
           the stream to read from
@return the store array for chaining purposes
@throws IOException
            if an error occurs while reading from the stream
@throws ArrayIndexOutOfBoundsException
            if bytes greater than the length of the store.
jme3-core/src/plugins/java/com/jme3/export/binary/ByteUtils.java