|
Java™ Platform Standard Ed. 7 DRAFT internal-b00 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.net.FtpFile
public class FtpFile
An FtpFile is a structure containing all the information that the FTP client can gather from the server by doing a LST (or NLST) command and parsing the output. It will typically contain the name, type, size, last modification lastModified, owner and group of the file, although some of these could be unavailable due to the FTP server limitation.
java.net.ftp.FtpFileParser| Nested Class Summary | |
|---|---|
static class |
FtpFile.Permission
|
static class |
FtpFile.Type
|
| Constructor Summary | |
|---|---|
FtpFile(String name)
Creates an FtpFile instance with only the name being set. |
|
| Method Summary | |
|---|---|
FtpFile |
addFact(String fact,
String value)
Adds a 'fact', as defined in RFC 3659, to the list of facts of this file. |
boolean |
canExexcute(FtpFile.Permission p)
Returns whether execute access is granted for a specific permission. |
boolean |
canRead(FtpFile.Permission p)
Returns whether read access is granted for a specific permission. |
boolean |
canWrite(FtpFile.Permission p)
Returns whether write access is granted for a specific permission. |
Date |
getCreated()
Returns the creation time of the file, when provided by the server. |
String |
getFact(String fact)
Returns the requested 'fact', as defined in RFC 3659, if available. |
String |
getGroup()
Returns the group name of the file as returned by the FTP server, if provided. |
Date |
getLastModified()
Returns the last modification time of the remote file as it was returned by the FTP server, if provided, null otherwise. |
String |
getName()
Returns the name of the remote file. |
long |
getSize()
Returns the size of the remote file as it was returned by the FTP server, if provided. |
FtpFile.Type |
getType()
Returns the type of the remote file as it was returned by the FTP server, if provided. |
String |
getUser()
Returns the user name of the owner of the file as returned by the FTP server, if provided. |
FtpFile |
setCreated(Date created)
Sets the creation time for that file. |
FtpFile |
setGroup(String group)
Sets the name of the group to which the file belong. |
FtpFile |
setLastModified(Date lastModified)
Sets the last modification time of the file. |
FtpFile |
setPermissions(boolean[][] permissions)
|
FtpFile |
setSize(long size)
Sets the size of that file. |
FtpFile |
setType(FtpFile.Type type)
Sets the type of the file. |
FtpFile |
setUser(String user)
Sets the user name of the owner of the file. |
String |
toString()
Returns a string representation of the object. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public FtpFile(String name)
name - The name of the file| Method Detail |
|---|
public String getName()
String containing the name of the remote file.public String getUser()
String containing the user name or
null if that information is not available.public FtpFile setUser(String user)
FtpFileParser implementation.
user - The user name of the owner of the file, or null
if that information is not available.
public String getGroup()
String containing the group name or
null if that information is not available.public FtpFile setGroup(String group)
FtpFileParser implementation.
group - The name of the group to which the file belong, or null
if that information is not available.
public long getSize()
public FtpFile setSize(long size)
FtpFileParser implementation.
size - The size, in bytes, of that file. or -1 if unknown.
public FtpFile.Type getType()
FtpFile.Type describing the type of the file
or null if that information is not available.public FtpFile setType(FtpFile.Type type)
FtpFileParser implementation.
type - the type of this file or null if that information
is not available.
public Date getLastModified()
null otherwise.
Date representing the last time the file was
modified on the server, or null if that
information is not available.public FtpFile setLastModified(Date lastModified)
FtpFileParser implementation.
lastModified - The Date representing the last modification time, or
null if that information is not available.
public boolean canRead(FtpFile.Permission p)
p - the Permission (user, group, others) to check.
true if read access is granted.public boolean canWrite(FtpFile.Permission p)
p - the Permission (user, group, others) to check.
true if write access is granted.public boolean canExexcute(FtpFile.Permission p)
p - the Permission (user, group, others) to check.
true if execute access is granted.public FtpFile setPermissions(boolean[][] permissions)
public FtpFile addFact(String fact,
String value)
FtpFileParser
implementation.
fact - the name of the fact (e.g. "Media-Type"). It is not case-sensitive.value - the value associated with this fact.
public String getFact(String fact)
fact - The name of the fact *e.g. "Media-Type"). It is not case sensitive.
null if that fact wasn't
provided by the server.public Date getCreated()
null
if the server didn't provide that information.public FtpFile setCreated(Date created)
FtpFileParser implementation.
created - the Date representing the creation time for that file, or
null if that information is not available.
public String toString()
toString method for class FtpFile
returns a string consisting of the name of the file, followed by its
type between brackets, followed by the user and group between
parenthesis, then size between '{', and, finally, the lastModified of last
modification if it's available.
toString in class Object
|
Java™ Platform Standard Ed. 7 DRAFT internal-b00 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.