public class VFile extends Object
| Constructor and Description |
|---|
VFile(Path path)
Constructor of this class.
|
VFile(String path)
Another constructor of this class.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canRead()
Check if we can read on this node.
|
boolean |
canWrite()
Check if we can write on this node.
|
boolean |
createNewFile()
Create a new file.
|
boolean |
delete()
Delete a file in the VFS tree.
|
boolean |
equals(Object obj) |
boolean |
exists()
Check if the file exist really.
|
String |
getMimeType()
Return String object with the name of the file type, for example: For the
case of the files .txt, this method return "text/plain"
|
String |
getName()
Call to getName method of Path class.
|
VFile |
getParent()
Return VFile object that represent the parent of the file in the VFS
tree.
|
Path |
getPath()
Return the path representation of the path attribute
|
int |
hashCode() |
boolean |
isDirectory()
Check if the node is a directory
|
boolean |
isFile()
Check if the node is a file.
|
String[] |
list()
Return String Array with the names of files and folder that they exist in
this path attribute.
|
VFile[] |
listFiles()
Return VFile Array with the names of files and folder that they exist in
this path attribute.
|
boolean |
mkdir()
Create a new directory.
|
void |
mount(VfsSource source)
Mount a node(file or folder) on VFS tree. for example, Let's suppose that
we want to mount the folder ("/etc/resources"), the call to the method:
mount(new FileSource(new File("/etc/resources")))
|
VFile[] |
search(GlobExpr globExpr)
This method we utilized it when we want to search any file inside of the
path for example: VFile[] files = file.search(new GlobExpr("*.txt"));
this code return VFile[] with all files with txt extension, we can
utilize in the quest any regular expression.
|
String |
toString()
Return String object, convert a path object to the String representation.
|
void |
unmount()
Unmount the las source mounted (if any) in this file off the VFS tree.
|
public VFile(Path path)
path - The Path object that represent the file or folder.public VFile(String path)
path - The string representation of the path (file or folder).public String getName()
public Path getPath()
public VFile getParent()
For example, if the path represented by this object equals to "usr/local/somefile", this method will return a VFile object where the path attribute has value"usr/local".
public boolean isDirectory()
public boolean exists()
public boolean createNewFile()
public boolean delete()
public boolean mkdir()
public boolean isFile()
public boolean canWrite()
public boolean canRead()
public void mount(VfsSource source) throws FileNotFoundException
source - VfsSource object
FileNotFoundException - If the underlying file does not exists.public void unmount()
throws FileNotFoundException
FileNotFoundException - If the underlying file does not exists.public String[] list()
public VFile[] listFiles()
public VFile[] search(GlobExpr globExpr)
globExpr - The expression to filter the files.public String getMimeType()
public String toString()
Copyright © 2015–2018 Bridje Framework. All rights reserved.