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(java.lang.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.
|
java.io.File |
getLocalFile()
Returns the local java.io.File object representation of the AQProjectFile
|
java.lang.String |
getName()
Returns the file name.
|
java.lang.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(java.lang.String filter)
Returns an array of files and folders in a project folder, satisfying the specified
file name filter.
|
java.lang.String |
read()
Reads the file content into a string assuming UTF-8 encoding.
|
java.lang.String |
read(java.lang.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(java.lang.String text)
Writes the text string to a file using UTF-8 encoding.
|
void |
write(java.lang.String text,
java.lang.String encoding)
Writes the text string to a file using the specified encoding.
|
java.lang.String getName()
java.io.File getLocalFile()
java.lang.String getPath()
int getLength()
boolean exists()
boolean isFile()
boolean isFolder()
AQProjectFile[] list()
AQProjectFile[] list(java.lang.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(java.lang.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()
java.lang.String read() throws java.lang.Exception
java.lang.Exception
- On errorjava.lang.String read(java.lang.String encoding) throws java.lang.Exception
encoding
- Character encoding.java.lang.Exception
- On errorbyte[] readBytes() throws java.lang.Exception
java.lang.Exception
- On errorvoid write(java.lang.String text) throws java.lang.Exception
text
- the text to writejava.lang.Exception
- On errorvoid write(java.lang.String text, java.lang.String encoding) throws java.lang.Exception
Charset
class.
Example:
write("text\n", "EUC-JP");
text
- the text to writeencoding
- the encodingjava.lang.Exception
- On errorvoid write(byte[] bytes) throws java.lang.Exception
bytes
- the bytes to writejava.lang.Exception
- On errorboolean createFolder()
Copyright © 2017 AquaFold, Inc. All Rights Reserved. Use is subject to license terms.