Constructor | |
Not available. Object is created by method newFile() of class WServer. | |
Methods | |
String |
read(String app, String file) Reads the text file from ".../app/data" folder. Parameters: app - the application name file - the file name Returns: a String that represents the file content Example: read("myapp","myfile.txt"); |
int |
write(String app, String file, String content) Writes to the text file in ".../app/data" folder. Overwrites the content if the file already exists. Parameters: app - the application name file - the file name to content - the content to write Returns: 0 if the write is successfull; -1 otherwise Example: write("myapp","myfile.txt","my text..."); |
int |
writeEnd(String app, String file, String content) Writes to the end of the text file in ".../app/data" folder. Parameters: app - the application name file - the file name content - the content to write Returns: 0 if the write is successfull; -1 otherwise Example: writeEnd("myapp","myfile.txt","my text..."); |
int |
copy(String appFrom, String fileFrom, String appTo, String fileTo) Copies the file from ".../appFrom/data" to ".../appTo/data" folder. Parameters: appFrom - the application name to copy from fileFrom - the file name to copy from appTo - the application name to copy to fileTo - the file name to copy to Returns: 0 if the file copied successfully; -1 otherwise Example: copy("myapp_from","myfile_from.txt","myapp_to","myfile_to.txt"); |
boolean |
isFile(String app, String file) Checks if the file exists in ".../app/data" folder. Parameters: app - the application name file - the file name to check Returns: true if the file exists; false otherwise Example: isFile("myapp","myfile.txt"); |
int |
size(String app, String file) Returns the size of the file in ".../app/data" folder. Parameters: app - the application name file - the file name to delete Example: size = size("myapp","myfile.txt"); |
int |
delete(String app, String file) Deletes the file in ".../app/data" folder. Parameters: app - the application name file - the file name to delete Returns: 0 if the file deleted successfully; -1 otherwise Example: delete("myapp","myfile.txt"); |
int |
upload(String app, WParamList oParamList) Creates uploaded files on the server, in ".../app/data" folder. Parameters: app - the application name to create the files in oParamList - the list of file names to assign to the uploaded files If no names provided, the file names stay as they are uploaded. Returns: 0 if the files are uploaded successfully; -1 otherwise |
int |
scale(String appFrom, String fileFrom, String appTo, String fileTo, int width, int height) Scales image file from ".../appFrom/data" to ".../appTo/data" folder. Parameters: appFrom - the application name fileFrom - the file name to scale from appTo - the application name fileTo - the file name to scale to width - the width to scale to height - the height to scale to Example: scale("myapp","mypic_from.jpg","myapp","mypic_to.jpg",400,0); // scales to 400 pixel width scale("myapp","mypic_from.jpg","myapp","mypic_to.jpg",0,100); // scales to 100 pixel height |
Example | |
api_WFile.java |