Class RemoteFile

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<java.io.File>

    public class RemoteFile
    extends java.io.File
    File wrapper for remote files. Is necessary because JFileChooser works with File objects only.
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected FileData filedata
      The file data.
      • Fields inherited from class java.io.File

        pathSeparator, pathSeparatorChar, separator, separatorChar
    • Constructor Summary

      Constructors 
      Constructor Description
      RemoteFile​(FileData filedata)
      Create a directory representation of a jar file.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static RemoteFile[] convertToFiles​(FileData[] remfiles)
      Convert remote files to files.
      boolean exists()
      Check if the file exists.
      java.lang.String getAbsolutePath()
      Get the path.
      java.io.File getCanonicalFile()
      Get the canonical name.
      java.lang.String getCanonicalPath()  
      FileData getFiledata()
      Get the filedata.
      java.lang.String getName()
      Get the file name.
      java.lang.String getParent()
      Get the parent name.
      java.io.File getParentFile()
      Get the parent file.
      java.lang.String getPath()
      Get the path.
      boolean isAbsolute()
      Test if absolute.
      boolean isDirectory()
      Test if is a directory.
      boolean isFile()
      Test if is a file.
      boolean isHidden()
      Test if file is hidden.
      long lastModified()
      Get the last modified date.
      java.lang.String[] list()
      List contained filed.
      java.io.File[] listFiles()  
      java.io.File[] listFiles​(java.io.FileFilter filter)  
      java.io.File[] listFiles​(java.io.FilenameFilter filter)  
      static void main​(java.lang.String[] args)
      Main for testing.
      java.lang.String toString()
      Get the string representation.
      • Methods inherited from class java.io.File

        canExecute, canRead, canWrite, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, getAbsoluteFile, getFreeSpace, getTotalSpace, getUsableSpace, hashCode, length, list, listRoots, mkdir, mkdirs, renameTo, setExecutable, setExecutable, setLastModified, setReadable, setReadable, setReadOnly, setWritable, setWritable, toPath, toURI, toURL
      • Methods inherited from class java.lang.Object

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

      • filedata

        protected FileData filedata
        The file data.
    • Constructor Detail

      • RemoteFile

        public RemoteFile​(FileData filedata)
        Create a directory representation of a jar file.
    • Method Detail

      • getFiledata

        public FileData getFiledata()
        Get the filedata.
        Returns:
        the filedata.
      • isDirectory

        public boolean isDirectory()
        Test if is a directory.
        Overrides:
        isDirectory in class java.io.File
        Returns:
        True, if directory.
      • listFiles

        public java.io.File[] listFiles​(java.io.FileFilter filter)
        Overrides:
        listFiles in class java.io.File
      • listFiles

        public java.io.File[] listFiles​(java.io.FilenameFilter filter)
        Overrides:
        listFiles in class java.io.File
      • listFiles

        public java.io.File[] listFiles()
        Overrides:
        listFiles in class java.io.File
      • lastModified

        public long lastModified()
        Get the last modified date.
        Overrides:
        lastModified in class java.io.File
      • exists

        public boolean exists()
        Check if the file exists.
        Overrides:
        exists in class java.io.File
      • getName

        public java.lang.String getName()
        Get the file name.
        Overrides:
        getName in class java.io.File
        Returns:
        The file name.
      • getAbsolutePath

        public java.lang.String getAbsolutePath()
        Get the path.
        Overrides:
        getAbsolutePath in class java.io.File
      • getPath

        public java.lang.String getPath()
        Get the path.
        Overrides:
        getPath in class java.io.File
      • getParent

        public java.lang.String getParent()
        Get the parent name.
        Overrides:
        getParent in class java.io.File
        Returns:
        The parent name.
      • getParentFile

        public java.io.File getParentFile()
        Get the parent file.
        Overrides:
        getParentFile in class java.io.File
      • isAbsolute

        public boolean isAbsolute()
        Test if absolute.
        Overrides:
        isAbsolute in class java.io.File
        Returns:
        Treu, if absolute.
      • getCanonicalPath

        public java.lang.String getCanonicalPath()
                                          throws java.io.IOException
        Overrides:
        getCanonicalPath in class java.io.File
        Throws:
        java.io.IOException
      • getCanonicalFile

        public java.io.File getCanonicalFile()
                                      throws java.io.IOException
        Get the canonical name. Needs to return this because JFileCooser uses this method to check isTraverable(), i.e. if a dir can be looked into. Hence, the dir property must be kept in returned file.
        Overrides:
        getCanonicalFile in class java.io.File
        Throws:
        java.io.IOException
      • isFile

        public boolean isFile()
        Test if is a file.
        Overrides:
        isFile in class java.io.File
        Returns:
        True, if is a file.
      • isHidden

        public boolean isHidden()
        Test if file is hidden.
        Overrides:
        isHidden in class java.io.File
        Returns:
        True, if hidden.
      • list

        public java.lang.String[] list()
        List contained filed. JFileChooser uses the FileSystemView.
        Overrides:
        list in class java.io.File
      • toString

        public java.lang.String toString()
        Get the string representation.
        Overrides:
        toString in class java.io.File
        Returns:
        The string representation.
      • convertToFiles

        public static RemoteFile[] convertToFiles​(FileData[] remfiles)
        Convert remote files to files.
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Main for testing.
        Throws:
        java.lang.Exception