/** * Creates an input stream for the URI, assuming it's a URL, and returns it. * * @return an open input stream. * @exception IOException if there is a problem obtaining an open input stream. */ @Override public InputStream createInputStream(URI uri, Map<?, ?> options) throws IOException { try { final HttpURLConnection httpConnection = getConnection(uri); httpConnection.setConnectTimeout(connectionTimeout); httpConnection.setReadTimeout(readTimeout); InputStream result = httpConnection.getInputStream(); Map<Object, Object> response = getResponse(options); if (response != null) { response.put( URIConverter.RESPONSE_TIME_STAMP_PROPERTY, httpConnection.getLastModified()); } return result; } catch (RuntimeException exception) { throw new Resource.IOWrappedException(exception); } }
/** * Creates an output stream for the URI, assuming it's a URL, and returns it. * @return an open output stream. * @exception IOException if there is a problem obtaining an open output stream. */ protected OutputStream createURLOutputStream(URI uri) throws IOException { try { URL url = new URL(uri.toString()); URLConnection urlConnection = url.openConnection(); urlConnection.setDoOutput(true); return urlConnection.getOutputStream(); } catch (RuntimeException exception) { throw new Resource.IOWrappedException(exception); } }
/** * Creates an input stream for the URI, assuming it's a URL, and returns it. * @return an open input stream. * @exception IOException if there is a problem obtaining an open input stream. */ protected InputStream createURLInputStream(URI uri) throws IOException { try { URL url = new URL(uri.toString()); URLConnection urlConnection = url.openConnection(); return urlConnection.getInputStream(); } catch (RuntimeException exception) { throw new Resource.IOWrappedException(exception); } }
/** * Creates an input stream for the URI, assuming it's a URI recognized by the Eclipse File System, and returns it. * @return an open input stream. * @exception IOException if there is a problem obtaining an open input stream. */ protected InputStream createEFSInputStream(URI uri) throws IOException { if (EFS_GET_STORE_METHOD != null) { try { Object store = EFS_GET_STORE_METHOD.invoke(null, new java.net.URI(uri.toString())); if (store != null) { return (InputStream)FILE_STORE_OPEN_INPUT_STREAM_METHOD.invoke(store, 0, null); } } catch (Exception exception) { throw new Resource.IOWrappedException(exception); } } throw new IOException("EFS unavailable"); }
/** * Creates an output stream for the URI, assuming it's a URI recognized by the Eclipse File System, and returns it. * @return an open output stream. * @exception IOException if there is a problem obtaining an open output stream. */ protected OutputStream createEFSOutputStream(URI uri) throws IOException { if (EFS_GET_STORE_METHOD != null) { try { Object store = EFS_GET_STORE_METHOD.invoke(null, new java.net.URI(uri.toString())); if (store != null) { return (OutputStream)FILE_STORE_OPEN_OUTPUT_STREAM_METHOD.invoke(store, 0, null); } } catch (Exception exception) { throw new Resource.IOWrappedException(exception); } } throw new IOException("EFS unavailable"); }
/** * Creates an output stream for the URI, assuming it's a URL, and returns it. * @return an open output stream. * @exception IOException if there is a problem obtaining an open output stream. */ protected OutputStream createURLOutputStream(URI uri) throws IOException { try { URL url = new URL(uri.toString()); URLConnection urlConnection = url.openConnection(); urlConnection.setDoOutput(true); return urlConnection.getOutputStream(); } catch (RuntimeException exception) { throw new Resource.IOWrappedException(exception); } }
public InputStream createPlatformResourceInputStream(String platformResourcePath) throws IOException { IFile file = WORKSPACE_ROOT.getFile(new Path(platformResourcePath)); try { if (!file.isSynchronized(IResource.DEPTH_ONE)) { try { File iofile = file.getFullPath().toFile(); if (iofile.exists() || file.exists()) file.refreshLocal(IResource.DEPTH_ONE, null); } catch (CoreException ce) { if (ce.getStatus().getCode() != IResourceStatus.WORKSPACE_LOCKED) throw ce; } } // CHANGED from <no-args> to <true> [94015] return file.getContents(true); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
protected void createContainer(IContainer container) throws IOException { if (!container.exists()) { if (container.getType() == IResource.FOLDER) { createContainer(container.getParent()); try { ((IFolder)container).create(force, keepHistory, progressMonitor); } catch (CoreException exception) { throw new ResourceImpl.IOWrappedException(exception); } } } }
/** * Creates an input stream for the URI, assuming it's a URL, and returns it. * @return an open input stream. * @exception IOException if there is a problem obtaining an open input stream. */ protected InputStream createURLInputStream(URI uri) throws IOException { try { URL url = new URL(uri.toString()); URLConnection urlConnection = url.openConnection(); return urlConnection.getInputStream(); } catch (RuntimeException exception) { throw new Resource.IOWrappedException(exception); } }
protected void createContainer(IContainer container) throws IOException { if (!container.exists()) { if (container.getType() == IResource.FOLDER) { createContainer(container.getParent()); try { ((IFolder)container).create(force, keepHistory, progressMonitor); } catch (CoreException exception) { throw new ResourceImpl.IOWrappedException(exception); } } } }
/** * Returns the {@link IFile#getCharset() character set) for the file at the specified location. * @since 2.9 */ public static String getCharset(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { return file.getCharset(); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
private void registerProxy(InternalCDOView view) throws IOWrappedException { try { view.registerProxyResource(this); } catch (Exception ex) { OM.LOG.error(ex); setExisting(false); cdoInternalSetState(CDOState.TRANSIENT); throw new IOWrappedException(ex); } }
/** * Returns the {@link IFile#getCharset() character set} for the file at the specified location. * @since 2.9 */ public static String getCharset(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { return file.getCharset(); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
protected void handleErrors() throws IOException { if (!resource.getErrors().isEmpty()) { Resource.Diagnostic error = resource.getErrors().get(0); if (error instanceof Exception) { throw new Resource.IOWrappedException((Exception)error); } else { throw new IOException(error.getMessage()); } } }
private void registerProxy(InternalCDOView view) throws IOWrappedException { try { view.registerProxyResource(this); } catch (Exception ex) { OM.LOG.error(ex); setExisting(false); cdoInternalSetState(CDOState.TRANSIENT); throw new IOWrappedException(ex); } }
protected void handleErrors() throws IOException { if (!resource.getErrors().isEmpty()) { Resource.Diagnostic error = resource.getErrors().get(0); if (error instanceof Exception) { throw new Resource.IOWrappedException((Exception)error); } else { throw new IOException(error.getMessage()); } } }
public static void delete(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { file.delete(true, null); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
public static IContentDescription getContentDescription(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { return file.getContentDescription(); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
public static IContentDescription getContentDescription(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { return file.getContentDescription(); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }
public static void delete(String platformResourcePath, Map<?, ?> options) throws IOException { IFile file = workspaceRoot.getFile(new Path(platformResourcePath)); try { file.delete(true, null); } catch (CoreException exception) { throw new Resource.IOWrappedException(exception); } }