/** * Returns a stream on the image contents. Returns null if a stream could * not be opened. * * @return the stream for loading the data */ protected InputStream getStream() { return getStream(url); }
/** * Returns a stream on the image contents. Returns null if a stream could * not be opened. * * @return the stream for loading the data */ protected InputStream getStream() { return getStream(getURL(url)); }
private static ImageData getImageData(URL url) { ImageData result = null; try (InputStream in = getStream(url)) { if (in != null) { result = new ImageData(in); } } catch (SWTException e) { if (e.code != SWT.ERROR_INVALID_IMAGE) { throw e; // fall through otherwise } } catch (IOException e) { Policy.getLog().log(new Status(IStatus.ERROR, Policy.JFACE, e.getLocalizedMessage(), e)); } return result; }
private static ImageData getImageData(URL url) { ImageData result = null; try (InputStream in = getStream(url)) { if (in != null) { result = new ImageData(in); } } catch (SWTException e) { if (e.code != SWT.ERROR_INVALID_IMAGE) { throw e; // fall through otherwise } } catch (IOException e) { Policy.getLog().log(new Status(IStatus.ERROR, Policy.JFACE, e.getLocalizedMessage(), e)); } return result; }
public ImageData getImageData() { ImageData result = null; InputStream in = getStream(); if (in != null) { try { result = new ImageData(in); } catch (SWTException e) { if (e.code != SWT.ERROR_INVALID_IMAGE) { throw e; // fall through otherwise } } finally { try { in.close(); } catch (IOException e) { Policy.getLog().log( new Status(IStatus.ERROR, Policy.JFACE, e .getLocalizedMessage(), e)); } } } return result; }
InputStream stream = getStream(); if( stream != null ) { try {