/** * Load data by URL. url must be not null. * Note, this method doesn't check if data or url is null. * @throws java.io.IOException */ void loadData() throws java.io.IOException { InputStream input = null; try { input = UrlUtil.openStream(url); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StreamUtil.transferBytes(UrlUtil.openStream(url), stream); data = stream.toByteArray(); } finally { if (input != null) { input.close(); } } } }
/** * Load data by URL. url must be not null. * Note, this method doesn't check if data or url is null. * @throws java.io.IOException */ void loadData() throws java.io.IOException { InputStream input = null; try { input = UrlUtil.openStream(url); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StreamUtil.transferBytes(UrlUtil.openStream(url), stream); data = stream.toByteArray(); } finally { if (input != null) { input.close(); } } } }
/** * Load data from URL. url must be not null. * Note, this method doesn't check if data or url is null. * @throws java.io.IOException */ void loadData() throws java.io.IOException { RandomAccessFileOrArray raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(url)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StreamUtil.transferBytes(raf, stream); raf.close(); data = stream.toByteArray(); }
/** * Load data from URL. url must be not null. * Note, this method doesn't check if data or url is null. * @throws java.io.IOException */ void loadData() throws java.io.IOException { RandomAccessFileOrArray raf = new RandomAccessFileOrArray(new RandomAccessSourceFactory().createSource(url)); ByteArrayOutputStream stream = new ByteArrayOutputStream(); StreamUtil.transferBytes(raf, stream); raf.close(); data = stream.toByteArray(); }