com.microfocus.awm.core.internal

## Class WorkspaceFileDescriptorReader

- java.lang.Object
- - com.microfocus.awm.core.internal.WorkspaceFileDescriptorReader

- All Implemented Interfaces:
    IFileDescriptorReader

      public class WorkspaceFileDescriptorReader
      extends java.lang.Object
      implements IFileDescriptorReader

  Implementation of the `IFileDescriptorReader` for file descriptors with the type `EFileTypes.WORKSPACE_FILE`.
  Author:
    Ralf Pakosch

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `WorkspaceFileDescriptorReader()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `fileExists(FileDescriptor pFileDescriptor, IExecutionContext pContext, org.eclipse.core.runtime.IProgressMonitor pMon)` Checks whether the file exists on the target system.
    `IGetDataResponse` | `getContents(FileDescriptor pFileDescr, IExecutionContext pContext)` Gets the contents of the target file.
    `java.lang.String` | `interpreteFilePath(java.lang.String workspacePath, IExecutionContext context)` Resolves references in the given workspace path (can be relative or absolute).
    `void` | `setContents(java.io.InputStream pInputStream, FileDescriptor pFileDescriptor, IExecutionContext pContext, org.eclipse.core.runtime.IProgressMonitor pMon)` Creates a file with the given input stream.
    `void` | `setContents(java.io.InputStream pInputStream, FileDescriptor pFileDescriptor, IExecutionContext pContext, java.lang.String pLocalCP, org.eclipse.core.runtime.IProgressMonitor pMon)` Sets the contents of the target file.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### WorkspaceFileDescriptorReader

          public WorkspaceFileDescriptorReader()

  - ### Method Detail

    - #### getContents

          public IGetDataResponse getContents(FileDescriptor pFileDescr,
                                              IExecutionContext pContext)
                                       throws java.io.IOException

      Description copied from interface: `IFileDescriptorReader`
      Gets the contents of the target file.
      Specified by:
        `getContents` in interface `IFileDescriptorReader`
      Parameters:
        `pFileDescr` - the target file descriptor
        `pContext` - the execution context
      Returns:
        a get data response containing the contents of the file
      Throws:
        `java.io.IOException` - if reading the file fails

    - #### setContents

          public void setContents(java.io.InputStream pInputStream,
                                  FileDescriptor pFileDescriptor,
                                  IExecutionContext pContext,
                                  org.eclipse.core.runtime.IProgressMonitor pMon)
                           throws java.io.IOException

      Creates a file with the given input stream. The `NamePhysical` attribute of the given `File Descriptor` will be the workspace-relative path of the created file.
      Specified by:
        `setContents` in interface `IFileDescriptorReader`
      Parameters:
        `pInputStream` - the new contents
        `pFileDescriptor` - the target file descriptor
        `pContext` - the context
        `pMon` - progress monitor
      Throws:
        `java.io.IOException` - if setting the file contents fails

    - #### interpreteFilePath

          public java.lang.String interpreteFilePath(java.lang.String workspacePath,
                                                     IExecutionContext context)
                                              throws java.io.IOException

      Resolves references in the given workspace path (can be relative or absolute).
      Parameters:
        `workspacePath` - the workspace path
        `context` - the context
      Returns:
        the resolved path or null if no path can be determined
      Throws:
        `java.io.IOException` - when the AWM application cache folder cannot be accessed.
      See Also:
        `TaurusUtility.resolveReference(String, IExecutionContext)`

    - #### setContents

          public void setContents(java.io.InputStream pInputStream,
                                  FileDescriptor pFileDescriptor,
                                  IExecutionContext pContext,
                                  java.lang.String pLocalCP,
                                  org.eclipse.core.runtime.IProgressMonitor pMon)
                           throws java.io.IOException

      Sets the contents of the target file.
      Parameters:
        `pInputStream` - the new file contents
        `pFileDescriptor` - the target file descriptor
        `pContext` - the execution context
        `pLocalCP` - the local code page used to create the input stream
        `pMon` - progress monitor
      Throws:
        `java.io.IOException` - if setting the file contents fails

    - #### fileExists

          public boolean fileExists(FileDescriptor pFileDescriptor,
                                    IExecutionContext pContext,
                                    org.eclipse.core.runtime.IProgressMonitor pMon)
                             throws java.io.IOException

      Description copied from interface: `IFileDescriptorReader`
      Checks whether the file exists on the target system.
      Specified by:
        `fileExists` in interface `IFileDescriptorReader`
      Parameters:
        `pFileDescriptor` - the file to check
        `pContext` - the execution context
        `pMon` - a progress monitor
      Returns:
        `true` if the file exists, otherwise `false`
      Throws:
        `java.io.IOException` - if an error occurs while checking the file existence

Copyright © 2015 Micro Focus GmbH. All rights reserved.