public interface AQProjectFile
File
,
a file corresponding to an instance of AQProjectFile may or may exist in the file system.
For example, to create a folder named "FOLDER" in the project's "User Files" directory one needs to
create an instance of AQProjectFile first, then call createFolder()
:
var f = aqua.project.getUserFile("FOLDER"); f.createFolder();
Modifier and Type | Method and Description |
---|---|
AQProjectFile[] |
collectFilesRecursively()
Recursively collects files in a project folder and its descendant folders, excluding system and hidden files.
|
AQProjectFile[] |
collectFilesRecursively(String filter)
Recursively collects files in a project folder and its descendant folders.
|
boolean |
createFolder()
Creates a folder corresponding to this file object.
|
boolean |
exists()
Returns true if the file exists.
|
int |
getLength()
Returns the file length in bytes.
|
File |
getLocalFile()
Returns the local java.io.File object representation of the AQProjectFile
|
String |
getName()
Returns the file name.
|
String |
getPath()
Returns the file path.
|
boolean |
isFile()
Returns true if the underlying storage element is a file.
|
boolean |
isFolder()
Returns true if the underlying element is a folder.
|
AQProjectFile[] |
list()
Returns an array of files and folders in a project folder.
|
AQProjectFile[] |
list(String filter)
Returns an array of files and folders in a project folder, satisfying the specified
file name filter.
|
String |
read()
Reads the file content into a string assuming UTF-8 encoding.
|
String |
read(String encoding)
Reads the file content into a string using the specified encoding.
|
byte[] |
readBytes()
Reads the file content into a byte array.
|
boolean |
remove()
Deletes an underlying file object.
|
void |
write(byte[] bytes)
Writes the byte array to a file.
|
void |
write(String text)
Writes the text string to a file using UTF-8 encoding.
|
void |
write(String text,
String encoding)
Writes the text string to a file using the specified encoding.
|
String getName()
File getLocalFile()
String getPath()
int getLength()
boolean exists()
boolean isFile()
boolean isFolder()
AQProjectFile[] list()
AQProjectFile[] list(String filter)
filter
- File filter specification string.AQProjectFile[] collectFilesRecursively()
If this project file object does not denote a directory, then this method returns null.
AQProjectFile[] collectFilesRecursively(String filter)
null
filter is equivalent to a filter which excludes system and hidden files.
Returns an array of files.
If this project file object does not denote a directory, then this method returns null.
filter
- File filter specification string.boolean remove()
String read() throws Exception
Exception
- On errorString read(String encoding) throws Exception
encoding
- Character encoding.Exception
- On errorbyte[] readBytes() throws Exception
Exception
- On errorvoid write(String text) throws Exception
text
- the text to writeException
- On errorvoid write(String text, String encoding) throws Exception
Charset
class.
Example:
write("text\n", "EUC-JP");
text
- the text to writeencoding
- the encodingException
- On errorvoid write(byte[] bytes) throws Exception
bytes
- the bytes to writeException
- On errorboolean createFolder()
Copyright © 2017 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.