private InputStream getStream(ITypedElement input) throws CoreException { if (input instanceof IStreamContentAccessor) return ((IStreamContentAccessor)input).getContents(); return null; } }
private InputStream getStream(Object o) { if (o instanceof IStreamContentAccessor) { try { return ((IStreamContentAccessor)o).getContents(); } catch(CoreException ex) { // NeedWork } } return null; }
private InputStream getStream(Object o) { if (o instanceof IStreamContentAccessor) { try { return ((IStreamContentAccessor)o).getContents(); } catch(CoreException ex) { // NeedWork } } return null; }
private InputStream getStream(ITypedElement input) throws CoreException { if (input instanceof IStreamContentAccessor) return ((IStreamContentAccessor)input).getContents(); return null; } }
public InputStream getContents() throws CoreException { return streamContentAccessor.getContents(); }
InputStream is= null; try { is= sca.getContents(); if (is == null) return null;
public void execute(IProgressMonitor pm) throws InvocationTargetException { try { String taskName= Utilities.getString(bundle, "taskName"); //$NON-NLS-1$ pm.beginTask(taskName, IProgressMonitor.UNKNOWN); file.setContents(sa.getContents(), false, true, pm); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { pm.done(); } } };
InputStream is= null; try { is= sca.getContents(); if (is == null) return null;
@Override public void execute(IProgressMonitor pm) throws InvocationTargetException { try { String taskName= Utilities.getString(bundle, "taskName"); //$NON-NLS-1$ pm.beginTask(taskName, IProgressMonitor.UNKNOWN); file.setContents(sa.getContents(), false, true, pm); } catch (CoreException e) { throw new InvocationTargetException(e); } finally { pm.done(); } } };
public static String readString(IStreamContentAccessor sca, String encoding) throws CoreException { String s = null; try { try { s= Utilities.readString(sca.getContents(), encoding); } catch (UnsupportedEncodingException e) { if (!encoding.equals(ResourcesPlugin.getEncoding())) { s = Utilities.readString(sca.getContents(), ResourcesPlugin.getEncoding()); } } } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, e.getMessage(), e)); } return s; }
public static String readString(IStreamContentAccessor sca, String encoding) throws CoreException { String s = null; try { try { s= Utilities.readString(sca.getContents(), encoding); } catch (UnsupportedEncodingException e) { if (!encoding.equals(ResourcesPlugin.getEncoding())) { s = Utilities.readString(sca.getContents(), ResourcesPlugin.getEncoding()); } } } catch (IOException e) { throw new CoreException(new Status(IStatus.ERROR, CompareUIPlugin.PLUGIN_ID, 0, e.getMessage(), e)); } return s; }
protected String readString(IStreamContentAccessor streamContentAccessor) throws CoreException { InputStream inputStream = streamContentAccessor.getContents(); if (inputStream != null) { String encoding = getEncoding(streamContentAccessor); return readString(inputStream, encoding); } return null; }
protected void loadResource(Object element, Resource resource) { if (resource == null) { return; } if (element instanceof IStreamContentAccessor) { IStreamContentAccessor streamContentAccessor = (IStreamContentAccessor) element; InputStream inputStream = null; try { inputStream = streamContentAccessor.getContents(); if (inputStream != null) { resource.load(inputStream, Collections.singletonMap(XtextResource.OPTION_ENCODING, getEncoding(element))); } } catch (Exception exception) { throw new WrappedException(exception); } finally { if (inputStream != null) { try { inputStream.close(); } catch (IOException e) { e.printStackTrace(); } } } } }
IStreamContentAccessor sca= (IStreamContentAccessor) input; try { is= sca.getContents(); } catch (CoreException ex) {
IStreamContentAccessor sca= (IStreamContentAccessor) input; try { is= sca.getContents(); } catch (CoreException ex) {
IStreamContentAccessor isa= (IStreamContentAccessor) element; try { InputStream is= isa.getContents(); if (is != null) { InputStream bis= new BufferedInputStream(is);
public static String readString(IStreamContentAccessor sa) throws CoreException { InputStream is= sa.getContents(); if (is != null) { String encoding= null; if (sa instanceof IEncodedStreamContentAccessor) { try { encoding= ((IEncodedStreamContentAccessor) sa).getCharset(); } catch (Exception e) { } } if (encoding == null) encoding= ResourcesPlugin.getEncoding(); return readString(is, encoding); } return null; }
public static String readString(IStreamContentAccessor sa) throws CoreException { InputStream is= sa.getContents(); if (is != null) { String encoding= null; if (sa instanceof IEncodedStreamContentAccessor) { try { encoding= ((IEncodedStreamContentAccessor) sa).getCharset(); } catch (Exception e) { } } if (encoding == null) encoding= ResourcesPlugin.getEncoding(); return readString(is, encoding); } return null; }
public static String readString(IStreamContentAccessor sa) throws CoreException { InputStream is = sa.getContents(); if (is != null) { String encoding = null; if (sa instanceof IEncodedStreamContentAccessor) { try { encoding = ((IEncodedStreamContentAccessor) sa).getCharset(); } catch (Exception e) { } } if (encoding == null) encoding = ResourcesPlugin.getEncoding(); return readString(is, encoding); } return null; }
public static String readString(IStreamContentAccessor sa) throws CoreException { InputStream is= sa.getContents(); if (is != null) { String encoding= null; if (sa instanceof IEncodedStreamContentAccessor) { try { encoding= ((IEncodedStreamContentAccessor) sa).getCharset(); } catch (Exception e) { } } if (encoding == null) encoding= ResourcesPlugin.getEncoding(); return readString(is, encoding); } return null; }