Object prim_readprojurl(LContext lcontext) { Object[] objects = new Object[0]; if (((LContext) lcontext).projectURL == null) return objects; URL url; try { url = new URL(((LContext) lcontext).projectURL); } catch (MalformedURLException malformedurlexception) { Logo.error("Bad project URL: " + ((LContext) lcontext).projectURL, lcontext); return objects; } Object[][] objects_8_; try { ((LContext) lcontext).canvas.startLoading(); URLConnection urlconnection = url.openConnection(); urlconnection.connect(); int i = urlconnection.getContentLength(); byte[] is = new byte[i]; InputStream inputstream = urlconnection.getInputStream(); int i_9_ = 0; int i_10_ = 0; while (i_9_ >= 0 && i_10_ < i) { i_9_ = inputstream.read(is, i_10_, i - i_10_); if (i_9_ > 0) { i_10_ += i_9_; ((LContext) lcontext).canvas .loadingProgress((double) i_10_ / (double) i); } else { try { Thread.sleep(100L); } catch (InterruptedException interruptedexception) { /* empty */ } } } inputstream.close(); ObjReader objreader = new ObjReader(new ByteArrayInputStream(is)); objects_8_ = objreader.readObjects(lcontext); } catch (IOException ioexception) { Logo.error(("Problem reading project from URL: " + ((LContext) lcontext).projectURL), lcontext); return objects; } ((LContext) lcontext).canvas.stopLoading(); return objects_8_; }
Object prim_readprojfile(Object object, LContext lcontext) { Object[] objects = new Object[0]; ((LContext) lcontext).canvas.startLoading(); FileInputStream fileinputstream; try { fileinputstream = new FileInputStream(object.toString()); } catch (FileNotFoundException filenotfoundexception) { Logo.error("File not found: " + object, lcontext); return objects; } ((LContext) lcontext).canvas.loadingProgress(0.5); Object[][] objects_7_; try { ObjReader objreader = new ObjReader(fileinputstream); objects_7_ = objreader.readObjects(lcontext); fileinputstream.close(); } catch (IOException ioexception) { ioexception.printStackTrace(); return objects; } ((LContext) lcontext).canvas.stopLoading(); return objects_7_; }