diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java index d403a1159ae..1b70e073a90 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/servicesubsystem/FileServiceSubSystem.java @@ -22,6 +22,7 @@ package org.eclipse.rse.subsystems.files.core.servicesubsystem; import java.io.File; import java.io.InputStream; +import java.io.OutputStream; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.NullProgressMonitor; @@ -915,4 +916,20 @@ public final class FileServiceSubSystem extends RemoteFileSubSystem implements I return encoding; } -} + + /** + * Defers to the file service. + * @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#getInputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor) + */ + public InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { + return getFileService().getInputStream(monitor, remoteParent, remoteFile, isBinary); + } + + /** + * Defers to the file service. + * @see org.eclipse.rse.subsystems.files.core.subsystems.RemoteFileSubSystem#getOutputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor) + */ + public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { + return getFileService().getOutputStream(monitor, remoteParent, remoteFile, isBinary); + } +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java index cda42a3dff4..f593268d639 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/IRemoteFileSubSystem.java @@ -18,6 +18,7 @@ package org.eclipse.rse.subsystems.files.core.subsystems; import java.io.File; import java.io.InputStream; +import java.io.OutputStream; import java.net.InetAddress; import java.util.List; @@ -48,7 +49,7 @@ import org.eclipse.rse.subsystems.files.core.ILanguageUtilityFactory; * @lastgen interface RemoteFileSubSystem extends SubSystem {} */ -public interface IRemoteFileSubSystem extends ISubSystem{ +public interface IRemoteFileSubSystem extends ISubSystem { // ---------------------- // HELPER METHODS... @@ -400,8 +401,7 @@ public interface IRemoteFileSubSystem extends ISubSystem{ /** * Copy a set of remote files or folders to a new target parent folder. Precondition: Sources and target must all be on the same system! - * - * @param sourceFolderOrFiles The file or folder to copy + * @param sourceFolderOrFile The file or folder to copy * @param targetFolder The folder to copy to. * @return false true iff all copies succeeded */ @@ -724,4 +724,28 @@ public interface IRemoteFileSubSystem extends ISubSystem{ * no address can be resolved. */ public InetAddress getLocalAddress(); -} + + /** + * Gets the input stream to access the contents a remote file. Clients should close the input stream when done. + * @param remoteParent the absolute path of the parent. + * @param remoteFile the name of the remote file. + * @param isBinary true if the file is a binary file, false otherwise. + * @return the input stream to access the contents of the remote file. + * @param monitor the progress monitor. + * @throws SystemMessageException if an error occurs. + * @since 2.0 + */ + public InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException; + + /** + * Gets the output stream to write to a remote file. Clients should close the output stream when done. + * @param remoteParent the absolute path of the parent. + * @param remoteFile the name of the remote file. + * @param isBinary true if the file is a binary file, false otherwise. + * @return the input stream to access the contents of the remote file. + * @param monitor the progress monitor. + * @throws SystemMessageException if an error occurs. + * @since 2.0 + */ + public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException; +} \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java index 155f2f0e71e..58eced6eb96 100644 --- a/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java +++ b/rse/plugins/org.eclipse.rse.subsystems.files.core/src/org/eclipse/rse/subsystems/files/core/subsystems/RemoteFileSubSystem.java @@ -23,7 +23,9 @@ import java.io.BufferedReader; import java.io.DataInputStream; import java.io.File; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; +import java.io.OutputStream; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; @@ -66,6 +68,7 @@ import org.eclipse.rse.services.files.RemoteFileSecurityException; import org.eclipse.rse.services.search.IHostSearchResult; import org.eclipse.rse.services.search.IHostSearchResultConfiguration; import org.eclipse.rse.subsystems.files.core.model.RemoteFileFilterString; +import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; import org.eclipse.rse.ui.ISystemMessages; import org.eclipse.rse.ui.RSEUIPlugin; import org.eclipse.rse.ui.propertypages.SystemSubSystemPropertyPageCore; @@ -76,7 +79,7 @@ import org.eclipse.ui.dialogs.PropertyPage; /** * Specialization for file subsystem factories. * It is subclassed via use of a Rose model and MOF/EMF, or better yet - * by subclassing {@link org.eclipse.rse.core.servicesubsystem.impl.FileServiceSubSystem}. + * by subclassing {@link FileServiceSubSystem}. *

* For your convenience, there is built-in name filtering support. To use it, * call: @@ -431,7 +434,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi /** * Resolves filter strings. - * The default implementation of this simply calls {@link #internalResolveFilterString(IProgressMontior, String)}. + * The default implementation of this simply calls {@link #internalResolveFilterString(IProgressMonitor, String)}. * If the result for each filter string is a SystemMessage (e.g. an error), then the messages are returned. * If the result for any filter string is not a message (i.e. an array of children), then the children are returned, * and the messages are not. This avoids mixing chuldren as a result of successful resolution of a filter string with @@ -1143,7 +1146,7 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi * when there is separate filters for both folder names and filter names. * @param includeFilesOrFolders A constant from {@link org.eclipse.rse.core.subsystems.IFileConstants} * @param folderNameFilter The pattern to filter the folder names by. Can be null to include all folders - * @param nameFilter The pattern to filter the file names by. Can be null to include all files + * @param fileNameFilter The pattern to filter the file names by. Can be null to include all files */ protected void setListValues(int includeFilesOrFolders, String folderNameFilter, String fileNameFilter) { @@ -1768,4 +1771,20 @@ public abstract class RemoteFileSubSystem extends SubSystem implements IRemoteFi public String getRemoteEncoding() { return System.getProperty("file.encoding"); //$NON-NLS-1$ } -} + + /** + * The default implementation returns null. Subclasses should override if necessary. + * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getInputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor) + */ + public InputStream getInputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { + return null; + } + + /** + * The default implementation returns null. Subclasses should override if necessary. + * @see org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileSubSystem#getOutputStream(java.lang.String, java.lang.String, boolean, org.eclipse.core.runtime.IProgressMonitor) + */ + public OutputStream getOutputStream(String remoteParent, String remoteFile, boolean isBinary, IProgressMonitor monitor) throws SystemMessageException { + return null; + } +} \ No newline at end of file