public class YFiles extends YFunction
Modifier and Type | Class and Description |
---|---|
static interface |
YFiles.TimedReportCallback
TimedReportCallback for Files
|
static interface |
YFiles.UpdateCallback
Deprecated UpdateCallback for Files
|
Modifier and Type | Field and Description |
---|---|
protected int |
_filesCount |
protected int |
_freeSpace |
protected YFiles.UpdateCallback |
_valueCallbackFiles |
static int |
FILESCOUNT_INVALID
invalid filesCount value
|
static int |
FREESPACE_INVALID
invalid freeSpace value
|
_advertisedValue, _cacheExpiration, _className, _dataStreams, _func, _funId, _hwId, _lastErrorMsg, _lastErrorType, _logicalName, _serial, _userData, _valueCallbackFunction, _yapi, ADVERTISEDVALUE_INVALID, FUNCTIONDESCRIPTOR_INVALID, LOGICALNAME_INVALID
Modifier | Constructor and Description |
---|---|
protected |
YFiles(String func) |
protected |
YFiles(YAPIContext yctx,
String func) |
Modifier and Type | Method and Description |
---|---|
int |
_invokeValueCallback(String value) |
protected void |
_parseAttr(org.json.JSONObject json_val) |
byte[] |
download(String pathname)
Downloads the requested file and returns a binary buffer with its content.
|
boolean |
fileExist(String filename)
Test if a file exist on the filesystem of the module.
|
static YFiles |
FindFiles(String func)
Retrieves a filesystem for a given identifier.
|
static YFiles |
FindFilesInContext(YAPIContext yctx,
String func)
Retrieves a filesystem for a given identifier in a YAPI context.
|
static YFiles |
FirstFiles()
Starts the enumeration of filesystems currently accessible.
|
static YFiles |
FirstFilesInContext(YAPIContext yctx)
Starts the enumeration of filesystems currently accessible.
|
int |
format_fs()
Reinitialize the filesystem to its clean, unfragmented, empty state.
|
int |
get_filesCount()
Returns the number of files currently loaded in the filesystem.
|
int |
get_freeSpace()
Returns the free space for uploading new files to the filesystem, in bytes.
|
ArrayList<YFileRecord> |
get_list(String pattern)
Returns a list of YFileRecord objects that describe files currently loaded
in the filesystem.
|
int |
getFilesCount()
Returns the number of files currently loaded in the filesystem.
|
int |
getFreeSpace()
Returns the free space for uploading new files to the filesystem, in bytes.
|
YFiles |
nextFiles()
Continues the enumeration of filesystems started using yFirstFiles().
|
int |
registerValueCallback(YFiles.UpdateCallback callback)
Registers the callback function that is invoked on every change of advertised value.
|
int |
remove(String pathname)
Deletes a file, given by its full path name, from the filesystem.
|
byte[] |
sendCommand(String command) |
int |
upload(String pathname,
byte[] content)
Uploads a file to the filesystem, to the specified full path name.
|
_AddToCache, _clearDataStreamCache, _devRequest, _download, _escapeAttr, _FindFromCache, _FindFromCacheInContext, _get_json_path_struct, _get_json_path, _json_get_array, _json_get_key, _json_get_string, _parse, _parserHelper, _setAttr, _throw, _UpdateTimedReportCallbackList, _UpdateValueCallbackList, _upload, _upload, clearCache, describe, errMessage, errorMessage, errorType, errType, FindFunction, FindFunctionInContext, FirstFunction, FirstFunctionInContext, functionDescriptor, get_advertisedValue, get_errorMessage, get_errorType, get_friendlyName, get_functionDescriptor, get_functionId, get_hardwareId, get_logicalName, get_module, get_userData, getAdvertisedValue, getErrorMessage, getErrorType, getFriendlyName, getFunctionDescriptor, getFunctionId, getHardwareId, getLogicalName, getModule, getUserData, isOnline, load, loadAttribute, module, muteValueCallbacks, nextFunction, registerValueCallback, set_advertisedValue, set_logicalName, set_userData, setAdvertisedValue, setLogicalName, setUserData, toString, unmuteValueCallbacks, userData
public static final int FILESCOUNT_INVALID
public static final int FREESPACE_INVALID
protected int _filesCount
protected int _freeSpace
protected YFiles.UpdateCallback _valueCallbackFiles
protected YFiles(YAPIContext yctx, String func)
func
- : functionidprotected YFiles(String func)
protected void _parseAttr(org.json.JSONObject json_val) throws org.json.JSONException
_parseAttr
in class YFunction
org.json.JSONException
public int get_filesCount() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getFilesCount() throws YAPI_Exception
YAPI_Exception
- on errorpublic int get_freeSpace() throws YAPI_Exception
YAPI_Exception
- on errorpublic int getFreeSpace() throws YAPI_Exception
YAPI_Exception
- on errorpublic static YFiles FindFiles(String func)
func
- : a string that uniquely characterizes the filesystempublic static YFiles FindFilesInContext(YAPIContext yctx, String func)
yctx
- : a YAPI contextfunc
- : a string that uniquely characterizes the filesystempublic int registerValueCallback(YFiles.UpdateCallback callback)
callback
- : the callback function to call, or a null pointer. The callback function should take two
arguments: the function object of which the value has changed, and the character string describing
the new advertised value.public int _invokeValueCallback(String value)
_invokeValueCallback
in class YFunction
public byte[] sendCommand(String command) throws YAPI_Exception
YAPI_Exception
public int format_fs() throws YAPI_Exception
YAPI_Exception
- on errorpublic ArrayList<YFileRecord> get_list(String pattern) throws YAPI_Exception
pattern
- : an optional filter pattern, using star and question marks
as wildcards. When an empty pattern is provided, all file records
are returned.YAPI_Exception
- on errorpublic boolean fileExist(String filename) throws YAPI_Exception
filename
- : the file name to test.YAPI_Exception
- on errorpublic byte[] download(String pathname) throws YAPI_Exception
pathname
- : path and name of the file to downloadYAPI_Exception
- on errorpublic int upload(String pathname, byte[] content) throws YAPI_Exception
pathname
- : path and name of the new file to createcontent
- : binary buffer with the content to setYAPI_Exception
- on errorpublic int remove(String pathname) throws YAPI_Exception
pathname
- : path and name of the file to remove.YAPI_Exception
- on errorpublic YFiles nextFiles()
public static YFiles FirstFiles()
public static YFiles FirstFilesInContext(YAPIContext yctx)
yctx
- : a YAPI context.Copyright © 2017. All rights reserved.