Class FSPutil
-
- All Implemented Interfaces:
public class FSPutilUtilities for easier working with FSP.
There are some higher level function for working with FSP.
- Since:
1.0
Radim Kolar
-
-
Constructor Summary
Constructors Constructor Description FSPutil()
-
Method Summary
Modifier and Type Method Description static voiddownload(FSPsession session, String filename, OutputStream os, long start_from, long byteswanted)Downloads a file from FSP server. static voidupload(FSPsession session, String filename, InputStream is, long timestamp)Uploads file to FSP server static FSPstatstat(FSPsession session, String path)Gets information about file or directory. static booleanstatSupported(FSPsession session)Check if FSP server supports CC_STAT command. static Array<byte>stringToASCIIZ(String filename)Converts String to ASCIIZ byte array. static Array<String>list(FSPsession session, String directory)get a filename directory list from server. static Array<FSPstat>statlist(FSPsession session, String directory)get a FSPstat directory list from server. static FSPversionversion(FSPsession session)Sends CC_VERSION command to server and parses reply. static booleancanUpload(FSPsession session, String filename)Checks if user have enough rights to upload given file. -
-
Method Detail
-
download
static void download(FSPsession session, String filename, OutputStream os, long start_from, long byteswanted)
Downloads a file from FSP server.
This procedure download a file from FSP server, file is written to OutputStream. OutputStream is not closed at end of transfer.
- Parameters:
session- active FSP sessionfilename- filename on FSP serveros- write file to this streamstart_from- offset where to start downloadbyteswanted- how many bytes to download, <0 for all- Since:
1.0
-
upload
static void upload(FSPsession session, String filename, InputStream is, long timestamp)
Uploads file to FSP server
- Parameters:
session- opened FSPsession to target serverfilename- filename on remote serveris- InputStream to be sent to server.timestamp- timestamp for uploaded file, 0 if not used.- Since:
1.0rc7
-
stat
static FSPstat stat(FSPsession session, String path)
Gets information about file or directory.
This function requests information about specific path from FSP server. Server must support CC_STAT command, which is supported from FSP 2.8.1 Beta 11.
- Parameters:
session- FSPsessionpath- path for getting information- Returns:
FSPstat object or null if path is not found
- Since:
1.0
-
statSupported
static boolean statSupported(FSPsession session)
Check if FSP server supports CC_STAT command. This command is implemented in fspd from FSP suite version 2.8.1 Beta 11 or later.
This function is also suitable for detecting if FSP server is still alive. If you dont get IOException during function call then you are still connected to FSP server.
- Parameters:
session- FSPsession- Returns:
true if CC_STAT command is supported
- Since:
1.0
-
stringToASCIIZ
static Array<byte> stringToASCIIZ(String filename)
Converts String to ASCIIZ byte array.
- Parameters:
filename- string to be converted- Returns:
converted byte array NULL terminated
- Since:
1.0
-
list
static Array<String> list(FSPsession session, String directory)
get a filename directory list from server.
- Parameters:
session- live FSPsessiondirectory- directory to be listed- Returns:
file list
- Since:
1.0
-
statlist
static Array<FSPstat> statlist(FSPsession session, String directory)
get a FSPstat directory list from server.
- Parameters:
session- live FSPsessiondirectory- directory to be listed- Returns:
FSPstat list or null on error
- Since:
1.0
-
version
static FSPversion version(FSPsession session)
Sends CC_VERSION command to server and parses reply. Because some servers do not reply to CC_VERSION command, it should not be used for detection if FSPsession is still alive. Better is to use statSupported function instead.
- Parameters:
session- live FSPsession- Returns:
FSPversion object
- Since:
1.0rc7
-
canUpload
static boolean canUpload(FSPsession session, String filename)
Checks if user have enough rights to upload given file.
- Parameters:
session- opened FSPsessionfilename- file to be uploaded- Returns:
true if user can upload file
- Since:
1.0rc8
-
-
-
-