Class EclipseFile

    • Constructor Detail

      • EclipseFile

        protected EclipseFile​(org.eclipse.core.resources.IFile file)
    • Method Detail

      • unwrap

        public org.eclipse.core.resources.IFile unwrap()
        Description copied from interface: AAbstraction
        Returns the platform-specific object corresponding to this abstraction. The generic type parameter is used to avoid casts when assigning to platform-specific objects. It is the obligation of the caller to make sure the right type is used, otherwise a ClassCastException will be thrown.

        Sample usage:

         
         interface ACalendar extends AAbstraction[...]
         class LocalDateAsCalendarWrapper extends AWrapper<LocalDate>[...]
         [...]
         ACalendar calendar = Wrappers.of(LocalDate.now()).as(ACalendar.class);
         [...]
         LocalDate date = calendar.unwrap();
         
         
        Specified by:
        unwrap in interface AAbstraction
        Overrides:
        unwrap in class EclipseResource
        See Also:
        Wrappers#unwrap(AAbstraction) for a way to unwrap potentially null abstractions.
      • create

        public void create​(java.io.InputStream source,
                           org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: AFile
        Creates this file in the file-system with data from the given InputStream.
        Specified by:
        create in interface AFile
        Parameters:
        source - provides the data to be written to the new file
        monitor - a progress monitor that is notified about this process. The monitor may be null when progress does not need to be reported.
      • getContents

        public java.io.InputStream getContents()
        Description copied from interface: AFile
        Returns the file's data contents as an InputStream.
        Specified by:
        getContents in interface AFile
        Returns:
        the file's contents
      • setContents

        public void setContents​(java.io.InputStream source,
                                boolean keepHistory,
                                org.eclipse.core.runtime.IProgressMonitor monitor)
        Description copied from interface: AFile
        Overwrites this file in the file-system with data from the given InputStream.
        Specified by:
        setContents in interface AFile
        Parameters:
        source - provides the data to be written to the new file
        keepHistory - whether to keep a history of the content (if supported by the workspace)
        monitor - a progress monitor that is notified about this process. The monitor may be null when progress does not need to be reported.
      • isReadOnly

        public boolean isReadOnly()
        Description copied from interface: AFile
        Returns whether this file is read-only (meaning data can be read but not written).
        Specified by:
        isReadOnly in interface AFile
        Returns:
        whether this file is read-only
      • getExtension

        public java.lang.String getExtension()
        Description copied from interface: AFile
        Returns the corresponding file's extension (the part after the last '.'), if there is any.
        Specified by:
        getExtension in interface AFile
        Returns:
        this file's extension or an empty String if the file has no extension