Class EclipseIFile

  • All Implemented Interfaces:
    IIFile, IIResource

    public class EclipseIFile
    extends java.lang.Object
    implements IIFile
    The Eclipse file wrapper.
    Author:
    Christopher Mindus
    • Constructor Summary

      Constructors 
      ConstructorDescription
      EclipseIFile​(org.eclipse.core.resources.IFile ifile)
      Constructs a file.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and TypeMethodDescription
      booleanequals​(java.lang.Object o)
      Compares two resources.
      java.io.FilegetFile​(java.lang.Object monitor)
      Get the Java canonical File.
      longgetFileSize()
      Gets the file size.
      java.lang.StringgetFullPath()
      Gets the full path to the resource.
      longgetLastModified()
      Gets the file modified time in milliseconds since the epoch.
      java.lang.StringgetName()
      Gets the name of the resource.
      inthashCode()
      The hash code.
      booleanisDirectory()
      Checks if this resource is a directory.
      java.io.InputStreamopenInputStream​(java.lang.Object monitor)
      Opens the input stream to the file.
      java.lang.StringtoString()
      Resource String representation is the file name.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • EclipseIFile

        public EclipseIFile​(org.eclipse.core.resources.IFile ifile)
        Constructs a file.
    • Method Detail

      • getFullPath

        public java.lang.String getFullPath()
                                     throws java.io.IOException
        Gets the full path to the resource.
        Specified by:
        getFullPath in interface IIResource
        Throws:
        java.io.IOException - For I/O errors.
      • getFile

        public java.io.File getFile​(java.lang.Object monitor)
                             throws java.io.IOException
        Get the Java canonical File.
        Specified by:
        getFile in interface IIResource
        Parameters:
        monitor - The IProgressMonitor, null for none.
        Returns:
        a File in canonical form.
        Throws:
        java.io.IOException - For I/O errors.
      • openInputStream

        public java.io.InputStream openInputStream​(java.lang.Object monitor)
                                            throws java.io.IOException
        Opens the input stream to the file.
        Specified by:
        openInputStream in interface IIFile
        Parameters:
        monitor - The IProgressMonitor, null for none.
        Returns:
        The input stream.
        Throws:
        java.io.IOException - For read errors.
      • isDirectory

        public boolean isDirectory()
        Checks if this resource is a directory.
        Specified by:
        isDirectory in interface IIResource
        Returns:
        false.
      • getName

        public java.lang.String getName()
        Gets the name of the resource.
        Specified by:
        getName in interface IIResource
        Returns:
        The name of the resource (also includes the file extension).
      • equals

        public boolean equals​(java.lang.Object o)
        Compares two resources.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        The hash code.
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Resource String representation is the file name.
        Overrides:
        toString in class java.lang.Object
      • getFileSize

        public long getFileSize()
        Gets the file size.
        Specified by:
        getFileSize in interface IIFile
      • getLastModified

        public long getLastModified()
        Gets the file modified time in milliseconds since the epoch.
        Specified by:
        getLastModified in interface IIFile
        Returns:
        Milliseconds since 1st January 1970, 0:00.