public class Resource extends Object implements Cloneable, Comparable<Object>
| Modifier and Type | Field and Description |
|---|---|
static long |
UNKNOWN_SIZE
Constant unknown size
|
| Constructor and Description |
|---|
Resource()
Default constructor.
|
Resource(String name)
Only sets the name.
|
Resource(String name,
boolean exists,
long lastmodified)
Sets the name, lastmodified flag, and exists flag.
|
Resource(String name,
boolean exists,
long lastmodified,
boolean directory)
Sets the name, lastmodified flag, exists flag, and directory flag.
|
Resource(String name,
boolean exists,
long lastmodified,
boolean directory,
long size)
Sets the name, lastmodified flag, exists flag, directory flag, and size.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone()
Clone this Resource.
|
int |
compareTo(Object other)
Delegates to a comparison of names.
|
long |
getLastModified()
Tells the modification time in milliseconds since 01.01.1970 .
|
String |
getName()
Name attribute will contain the path of a file relative to the
root directory of its fileset or the recorded path of a zip
entry.
|
long |
getSize()
Get the size of this Resource.
|
boolean |
isDirectory()
Tells if the resource is a directory.
|
boolean |
isExists()
The exists attribute tells whether a file exists.
|
void |
setDirectory(boolean directory)
Set the directory attribute.
|
void |
setExists(boolean exists)
Set the exists attribute.
|
void |
setLastModified(long lastmodified)
Set the last modification attribute.
|
void |
setName(String name)
Set the name of this Resource.
|
void |
setSize(long size)
Set the size of this Resource.
|
public static final long UNKNOWN_SIZE
public Resource()
public Resource(String name)
This is a dummy, used for not existing resources.
name - relative path of the resource. Expects
"/" to be used as the directory separator.public Resource(String name, boolean exists, long lastmodified)
name - relative path of the resource. Expects
"/" to be used as the directory separator.exists - if true, this resource exists.lastmodified - the last modification time of this resource.public Resource(String name, boolean exists, long lastmodified, boolean directory)
name - relative path of the resource. Expects
"/" to be used as the directory separator.exists - if true the resource existslastmodified - the last modification time of the resourcedirectory - if true, this resource is a directorypublic Resource(String name, boolean exists, long lastmodified, boolean directory, long size)
name - relative path of the resource. Expects
"/" to be used as the directory separator.exists - if true the resource existslastmodified - the last modification time of the resourcedirectory - if true, this resource is a directorysize - the size of this resource.public String getName()
example for a file with fullpath /var/opt/adm/resource.txt in a file set with root dir /var/opt it will be adm/resource.txt.
"/" will be used as the directory separator.
public void setName(String name)
name - relative path of the resource. Expects
"/" to be used as the directory separator.public boolean isExists()
public void setExists(boolean exists)
exists - if true, this resource exists.public long getLastModified()
File.public void setLastModified(long lastmodified)
lastmodified - the modification time in milliseconds since 01.01.1970.public boolean isDirectory()
public void setDirectory(boolean directory)
directory - if true, this resource is a directory.public void setSize(long size)
size - the size, as a long.public long getSize()
public Object clone()
public int compareTo(Object other)
compareTo in interface Comparable<Object>other - the object to compare to.Copyright © 2001–2025. All rights reserved.