public class RelativeFile
extends java.lang.Object
RelativeFile contains
information on the file, the base directory and the relative path from the base directory to
the file. The relative path is kept in OS independent form with sub directories separated by
slashes.
Neither the file nor the base need to exist. They are treated as abstract paths.
| Modifier and Type | Class and Description |
|---|---|
static class |
RelativeFile.Type |
| Modifier and Type | Field and Description |
|---|---|
RelativeFile.Type |
type |
| Constructor and Description |
|---|
RelativeFile(java.io.File base,
java.io.File file)
Creates a new relative file.
|
RelativeFile(java.io.File base,
java.lang.String relativePath)
Creates a new relative file.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
static RelativeFile |
fileInDirectory(java.lang.String relativePath,
java.io.File file) |
java.io.File |
getBase()
Obtains the base directory or jar.
|
java.io.File |
getFile()
Returns the actual file from the directory.
|
java.lang.String |
getRelativePath()
Obtains the OS independent path.
|
RelativeFile.Type |
getType() |
int |
hashCode() |
java.lang.String |
toString() |
@NonNull public final RelativeFile.Type type
public RelativeFile(@NonNull
java.io.File base,
@NonNull
java.io.File file)
base - the base directory.file - the file, must not be the same as the base directory and must be located inside
basepublic RelativeFile(@NonNull
java.io.File base,
@NonNull
java.lang.String relativePath)
base - the base jar.relativePath - the relative path to the file.public static RelativeFile fileInDirectory(@NonNull java.lang.String relativePath, @NonNull java.io.File file)
@NonNull public java.io.File getBase()
Only applicable when getType() == RelativeFile.Type.JAR
@NonNull public java.lang.String getRelativePath()
@NonNull public RelativeFile.Type getType()
@NonNull public java.io.File getFile()
Only applicable when getType() == RelativeFile.Type.DIRECTORY
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object