org.finj
Class RemoteFile

java.lang.Object
  extended by org.finj.RemoteFile

public class RemoteFile
extends java.lang.Object

Class inspired on java.io.File, that represents files located on a distant computer. Note that instances of this class are non-mutable objects.

Copyright (C) 2000-2008 Javier Iglesias.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Version:
$Id: RemoteFile.java 47 2008-01-11 23:09:46Z jiglesias $
Author:
Javier Iglesias -- jiglesias@users.sourceforge.net

Constructor Summary
RemoteFile(java.lang.String path, java.lang.String name, boolean canRead, boolean canWrite, boolean isDir, boolean isHidden, long lastMod, long size)
           
 
Method Summary
 boolean canRead()
          Returns true if file can be read.
 boolean canWrite()
          Returns true if file can be written to.
 java.lang.String getName()
          Returns the name of the file.
 java.lang.String getParent()
          Returns parent path if it exists, null if not.
 java.lang.String getPath()
          Returns path to this file on the distant computer.
 boolean isDirectory()
          Returns true if path points to a directory, false else.
 boolean isFile()
          Returns true if path points to a file, false else.
 boolean isHidden()
          Tests whether the file named by this abstract pathname is a hidden file.
 long lastModified()
          Returns the time that the file was last modified, measured in milliseconds since 1970/01/01.
 long size()
          Returns the length of the file in bytes.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RemoteFile

public RemoteFile(java.lang.String path,
                  java.lang.String name,
                  boolean canRead,
                  boolean canWrite,
                  boolean isDir,
                  boolean isHidden,
                  long lastMod,
                  long size)
Since:
v1.0
Method Detail

getName

public java.lang.String getName()
Returns the name of the file.

Returns:
name of the file.
Since:
v1.0

getParent

public java.lang.String getParent()
Returns parent path if it exists, null if not.

Returns:
name of the parent if it exist, null else.
Since:
v1.0

getPath

public java.lang.String getPath()
Returns path to this file on the distant computer.

Returns:
path to this file.
Since:
v1.0

canRead

public boolean canRead()
Returns true if file can be read.

Returns:
true if file might be readable, false when it surely isn't.
Since:
v1.0

canWrite

public boolean canWrite()
Returns true if file can be written to.

Returns:
true if file might be writable, false when it surely isn't.
Since:
v1.0

isDirectory

public boolean isDirectory()
Returns true if path points to a directory, false else.

Returns:
true if file is a directory, false else.
Since:
v1.0

isFile

public boolean isFile()
Returns true if path points to a file, false else.

Returns:
true if file is a file, false else.
Since:
v1.0

isHidden

public boolean isHidden()
Tests whether the file named by this abstract pathname is a hidden file.

Returns:
true if file is hidden, false else.
Since:
v1.0

lastModified

public long lastModified()
Returns the time that the file was last modified, measured in milliseconds since 1970/01/01. FIXME : wouldn't it better to return a java.util.Date instead ?

Returns:
time elapsed in milliseconds since the Epoch, at time when file has been last modified.
Since:
v1.0

size

public long size()
Returns the length of the file in bytes.

Returns:
size of file in bytes.
Since:
v1.0

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Since:
v1.0


Copyright © 2009. All Rights Reserved.