Class JavaFile

java.lang.Object
com.iizix.app.builder.JavaFile
All Implemented Interfaces:
IIFile, IIResource

public class JavaFile extends Object implements IIFile
The Java file wrapper.
Author:
Christopher Mindus
  • Constructor Details

    • JavaFile

      public JavaFile(File file) throws IOException
      Constructs a file.
      Parameters:
      file - The file.
      Throws:
      IOException - For I/O errors or if file is a directory.
  • Method Details

    • getFullPath

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

      public File getFile(Object monitor)
      Get the Java canonical File.
      Specified by:
      getFile in interface IIResource
      Parameters:
      monitor - The IProgressMonitor, null for none.
      Returns:
      a File in canonical form.
    • openInputStream

      public InputStream openInputStream(Object monitor) throws 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:
      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 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(Object o)
      Compares two resources.
      Overrides:
      equals in class Object
    • hashCode

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

      public String toString()
      Resource String representation is the file name.
      Overrides:
      toString in class 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.