// Path: src/main/java/net/ilexiconn/magister/util/AndroidUtil.java
// public class AndroidUtil {
//     private static boolean runningOnAndroid = false;
//     private static boolean androidSupportCache = false;
// 
//     /**
//      * Check if the API is running on Android.
//      */
//     public static void checkAndroid() {
//         try {
//             Class.forName("android.view.View");
//             runningOnAndroid = true;
//             isCacheAvailableOnAndroid();
//         } catch (ClassNotFoundException e) {
//             runningOnAndroid = false;
//         }
//     }
// 
//     /**
//      * Check if the API is running on Android, and if it can use the Android caching utilities.
//      *
//      * @return true if the API is running on Android and can use the Android caching utilities.
//      */
//     public static boolean isCacheAvailableOnAndroid() {
//         try {
//             Class<?> cache = Class.forName("android.net.http.HttpResponseCache");
//             cache.getMethod("getInstalled").invoke(null);
//             androidSupportCache = true;
//         } catch (ClassNotFoundException e) {
//             LogUtil.printError("Could not find Class: android.net.http.HttpResponseCache", e.getCause());
//             androidSupportCache = false;
//         } catch (NoSuchMethodException e) {
//             LogUtil.printError("Could not find Method: getInstalled", e.getCause());
//             androidSupportCache = false;
//         } catch (IllegalAccessException e) {
//             LogUtil.printError("Could not access Method: getInstalled", e.getCause());
//             androidSupportCache = false;
//         } catch (InvocationTargetException e) {
//             LogUtil.printError("Failed to invoke Method: getInstalled", e.getCause());
//             androidSupportCache = false;
//         }
//         return androidSupportCache;
//     }
// 
//     public static boolean getRunningOnAndroid() {
//         return runningOnAndroid;
//     }
// 
//     public static boolean getAndroidSupportCache() {
//         return androidSupportCache;
//     }
// }
// 
// Path: src/main/java/net/ilexiconn/magister/util/LogUtil.java
// public class LogUtil {
//     private static String TAG = "MAGISTER.JAVA";
// 
//     /**
//      * Print an error to the system error stream. Will use the Log class if running on Android.
//      *
//      * @param description the error's description.
//      * @param throwable the throwable.
//      */
//     public static void printError(String description, Throwable throwable) {
//         String details = toPrettyString("Operating System", System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ")") + toPrettyString("Java Version", System.getProperty("java.version"));
//         String report = "---- Error Report ----\n" + description + "\n\n-- Crash Log --\n" + getStackTrace(throwable) + "\n-- System Details --\n" + details;
//         if (AndroidUtil.getRunningOnAndroid()) {
//             try {
//                 Class<?> logClass = Class.forName("android.util.Log");
//                 logClass.getMethod("e", String.class, String.class, Throwable.class).invoke(null, TAG, description, throwable);
//                 return;
//             } catch (Exception e) {
//                 System.err.println(report);
//             }
//         }
//         System.err.println(report);
//     }
// 
//     private static String toPrettyString(String key, String value) {
//         return key + "\n\t" + value + "\n";
//     }
// 
//     private static String getStackTrace(Throwable throwable) {
//         StringWriter stringWriter = new StringWriter();
//         PrintWriter printWriter = new PrintWriter(stringWriter);
// 
//         throwable.printStackTrace(printWriter);
//         String s = stringWriter.toString();
// 
//         try {
//             stringWriter.close();
//             printWriter.close();
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
// 
//         return s;
//     }
// 
//     /**
//      * Set a custom Android logging tag.
//      *
//      * @param tag the new tag.
//      */
//     public static void setAndroidTag(String tag) {
//         TAG = tag;
//     }
// }


import net.ilexiconn.magister.util.AndroidUtil;
import net.ilexiconn.magister.util.LogUtil;
import java.io.InputStream;
import java.lang.reflect.Method;
        if (AndroidUtil.getRunningOnAndroid()) {
            c = Class.forName("android.graphics.Bitmap");
        } else {
            c = Class.forName("java.awt.image.BufferedImage");
        }
        if (c == null) {
            throw new NullPointerException();
        }
        this.classT = c;
        try {
            classBitmap = Class.forName("android.graphics.Bitmap");
            if (!classT.equals(classBitmap)) {
                throw new Exception();
            }
            Method m = Class.forName("android.graphics.BitmapFactory").getMethod("decodeStream", InputStream.class);
            image = classT.cast(m.invoke(null, stream));
            return;
        } catch (Exception e) {
            if (!(e instanceof ClassNotFoundException)) {
                LogUtil.printError(e.getMessage(), e.getCause());
            }
        }
        try {
            classImage = Class.forName("java.awt.image.BufferedImage");
            if (!classT.equals(classImage)) {
                throw new Exception();
            }
            Method m = Class.forName("javax.imageio.ImageIO").getMethod("read", InputStream.class);
            image = classT.cast(m.invoke(null, stream));
            return;
// Path: src/main/java/net/ilexiconn/magister/util/AndroidUtil.java
// public class AndroidUtil {
//     private static boolean runningOnAndroid = false;
//     private static boolean androidSupportCache = false;
// 
//     /**
//      * Check if the API is running on Android.
//      */
//     public static void checkAndroid() {
//         try {
//             Class.forName("android.view.View");
//             runningOnAndroid = true;
//             isCacheAvailableOnAndroid();
//         } catch (ClassNotFoundException e) {
//             runningOnAndroid = false;
//         }
//     }
// 
//     /**
//      * Check if the API is running on Android, and if it can use the Android caching utilities.
//      *
//      * @return true if the API is running on Android and can use the Android caching utilities.
//      */
//     public static boolean isCacheAvailableOnAndroid() {
//         try {
//             Class<?> cache = Class.forName("android.net.http.HttpResponseCache");
//             cache.getMethod("getInstalled").invoke(null);
//             androidSupportCache = true;
//         } catch (ClassNotFoundException e) {
//             LogUtil.printError("Could not find Class: android.net.http.HttpResponseCache", e.getCause());
//             androidSupportCache = false;
//         } catch (NoSuchMethodException e) {
//             LogUtil.printError("Could not find Method: getInstalled", e.getCause());
//             androidSupportCache = false;
//         } catch (IllegalAccessException e) {
//             LogUtil.printError("Could not access Method: getInstalled", e.getCause());
//             androidSupportCache = false;
//         } catch (InvocationTargetException e) {
//             LogUtil.printError("Failed to invoke Method: getInstalled", e.getCause());
//             androidSupportCache = false;
//         }
//         return androidSupportCache;
//     }
// 
//     public static boolean getRunningOnAndroid() {
//         return runningOnAndroid;
//     }
// 
//     public static boolean getAndroidSupportCache() {
//         return androidSupportCache;
//     }
// }
// 
// Path: src/main/java/net/ilexiconn/magister/util/LogUtil.java
// public class LogUtil {
//     private static String TAG = "MAGISTER.JAVA";
// 
//     /**
//      * Print an error to the system error stream. Will use the Log class if running on Android.
//      *
//      * @param description the error's description.
//      * @param throwable the throwable.
//      */
//     public static void printError(String description, Throwable throwable) {
//         String details = toPrettyString("Operating System", System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ")") + toPrettyString("Java Version", System.getProperty("java.version"));
//         String report = "---- Error Report ----\n" + description + "\n\n-- Crash Log --\n" + getStackTrace(throwable) + "\n-- System Details --\n" + details;
//         if (AndroidUtil.getRunningOnAndroid()) {
//             try {
//                 Class<?> logClass = Class.forName("android.util.Log");
//                 logClass.getMethod("e", String.class, String.class, Throwable.class).invoke(null, TAG, description, throwable);
//                 return;
//             } catch (Exception e) {
//                 System.err.println(report);
//             }
//         }
//         System.err.println(report);
//     }
// 
//     private static String toPrettyString(String key, String value) {
//         return key + "\n\t" + value + "\n";
//     }
// 
//     private static String getStackTrace(Throwable throwable) {
//         StringWriter stringWriter = new StringWriter();
//         PrintWriter printWriter = new PrintWriter(stringWriter);
// 
//         throwable.printStackTrace(printWriter);
//         String s = stringWriter.toString();
// 
//         try {
//             stringWriter.close();
//             printWriter.close();
//         } catch (IOException e) {
//             e.printStackTrace();
//         }
// 
//         return s;
//     }
// 
//     /**
//      * Set a custom Android logging tag.
//      *
//      * @param tag the new tag.
//      */
//     public static void setAndroidTag(String tag) {
//         TAG = tag;
//     }
// }


// Path: src/main/java/net/ilexiconn/magister/util/android/ImageContainer.java
import net.ilexiconn.magister.util.AndroidUtil;
import net.ilexiconn.magister.util.LogUtil;
import java.io.InputStream;
import java.lang.reflect.Method;

        if (AndroidUtil.getRunningOnAndroid()) {
            c = Class.forName("android.graphics.Bitmap");
        } else {
            c = Class.forName("java.awt.image.BufferedImage");
        }
        if (c == null) {
            throw new NullPointerException();
        }
        this.classT = c;
        try {
            classBitmap = Class.forName("android.graphics.Bitmap");
            if (!classT.equals(classBitmap)) {
                throw new Exception();
            }
            Method m = Class.forName("android.graphics.BitmapFactory").getMethod("decodeStream", InputStream.class);
            image = classT.cast(m.invoke(null, stream));
            return;
        } catch (Exception e) {
            if (!(e instanceof ClassNotFoundException)) {
                LogUtil.printError(e.getMessage(), e.getCause());
            }
        }
        try {
            classImage = Class.forName("java.awt.image.BufferedImage");
            if (!classT.equals(classImage)) {
                throw new Exception();
            }
            Method m = Class.forName("javax.imageio.ImageIO").getMethod("read", InputStream.class);
            image = classT.cast(m.invoke(null, stream));
            return;
        } catch (Exception e) {