Fixed crash for InputStreams in multithreaded env

The InputStream path for loading and displaying GIFs had a design flaw
where the JNI Enviroment (JNIEnv) that was present during initial
creation was cached for later used in reading the InputStream. This
would cause a SIGSEGV if the thread the GifDrawable was created on
differed from the one it was displayed on. This is because JNIEnv
objects must not be shared between threads. Instead, the JavaVM object
is now cached at JNI start time. That is then stored instead of the
JNIEnv object, and when ever the JNIEnv obj is needed, it can be
properly retrieved from the VM. This further ensures that all JNI
methods are called while the thread is attached.

Lastly, there is a little extra defensive code in the stream read func.