Here you can find the source of loadObject(URL url)
public static Object loadObject(URL url)
//package com.java2s; //License from project: Open Source License import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; import java.io.ObjectInputStream; import java.net.URL; import java.util.zip.*; public class Main { public static Object loadObject(URL url) { return loadObject(url, false); }// www . j a v a2 s . c om public static Object loadObject(URL url, boolean zipped) { try { return tryLoadObject(url, zipped); } catch (IOException | ClassNotFoundException e) { throw new RuntimeException(e); } } public static Object tryLoadObject(URL url) throws IOException, ClassNotFoundException { return tryLoadObject(url, false); } public static Object tryLoadObject(URL url, boolean zipped) throws IOException, ClassNotFoundException { InputStream input_stream = new BufferedInputStream(url.openStream()); if (zipped) input_stream = new GZIPInputStream(input_stream); ObjectInputStream obj_stream; obj_stream = new ObjectInputStream(input_stream); Object obj = obj_stream.readObject(); obj_stream.close(); return obj; } }