|
OBEROn SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.oberon.util.FileUtils
public class FileUtils
Utilities for file (Local,FTP,HTTP) manipulation
Constructor Summary | |
---|---|
FileUtils()
|
Method Summary | |
---|---|
static void |
cleanDirs(java.lang.String path)
Remove all files from a local directory and its sub-directories |
static void |
cleanFTPDirs(com.oberon.ooql.ftp.FTPClient client,
java.lang.String path)
Remove all files from a FTP directory and its sub-directories |
static void |
cleanHTTPDirs(com.oberon.ooql.sdk.common.WebServiceClient client,
java.lang.String path)
Remove all files from a HTTP directory and its sub-directories |
static com.oberon.ooql.ftp.FTPClient |
connectFTP(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password)
Connects to an FTP server and login with the user account |
static com.oberon.ooql.sdk.common.WebServiceClient |
connectHTTP(java.lang.String url,
java.lang.String user,
java.lang.String password)
Connects to an HTTP server and login with the user account |
static void |
copyFile(java.io.File inputFile,
java.lang.String toPath,
java.lang.String toName,
boolean move)
Copy a local file to a given path If the given path doesn't exist, it will be created |
static void |
createLocalDir(java.lang.String path)
Create a new dir path in the local file-system |
static void |
deleteFTPFile(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.lang.String fileName)
Delete a file inside the FTP server (login with the user account) |
static void |
deleteHTTPFile(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String fileName)
Delete a file inside the HTTP server (login with the user account) |
static byte[] |
getBytesFromFile(java.lang.String fileName)
Get binary data from a local file |
static byte[] |
getBytesFromStream(java.io.DataInputStream is)
Get binary data from an input stream |
static byte[] |
getBytesFromStream(java.io.DataInputStream is,
ProgressCounter counter)
Get binary data from an input stream |
static void |
getFTPFile(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.lang.String path,
java.lang.String fileName,
java.lang.String toPath,
java.lang.String toName,
boolean move)
Download a file from an FTP server (login with the user account) to a local file |
static void |
getFTPFile(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.lang.String path,
java.lang.String fileName,
java.lang.String toPath,
java.lang.String toName,
boolean move,
com.oberon.ooql.ftp.FTPDataTransferListener listener)
Download a file from an FTP server (login with the user account) to a local file |
static void |
getHTTPFile(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String path,
java.lang.String fileName,
java.lang.String toPath,
java.lang.String toName,
boolean move)
Download a file from an HTTP server (login with the user account) to a local file |
static java.util.Vector<java.lang.String> |
listFiles(java.lang.String path)
List files in a local file-system directory and its sub-directories |
static java.util.Vector<java.lang.String> |
listFiles(java.lang.String path,
boolean subdirs)
List files in a local file-system directory |
static java.util.Vector<java.lang.String> |
listFTPFiles(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.lang.String path)
List files in a FTP folder ( and its sub-folders ) |
static java.util.Vector<java.lang.String> |
listHTTPFiles(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String path)
List files in a HTTP folder ( and its sub-folders ) |
static void |
moveFTPFile(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.lang.String fromFile,
java.lang.String toPath,
java.lang.String toName)
Move/rename a file inside the FTP server (login with the user account) |
static void |
moveHTTPFile(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.lang.String fromFile,
java.lang.String toPath,
java.lang.String toName)
Move/rename a file inside the HTTP server (login with the user account) |
static void |
putFTPFile(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.io.File sourceFile,
java.lang.String toPath,
java.lang.String toName,
boolean move)
Upload a local file to an FTP server (login with the user account) |
static void |
putFTPFile(java.lang.String host,
int port,
java.lang.String user,
java.lang.String password,
java.io.File sourceFile,
java.lang.String toPath,
java.lang.String toName,
boolean move,
com.oberon.ooql.ftp.FTPDataTransferListener listener)
Upload a local file to an FTP server (login with the user account) |
static void |
putHTTPFile(java.lang.String url,
java.lang.String user,
java.lang.String password,
java.io.File sourceFile,
java.lang.String toPath,
java.lang.String toName,
boolean move)
Upload a local file to an HTTP server (login with the user account) |
static void |
removeLocalDir(java.lang.String path)
Remove a directory and its sub-directories |
static java.io.File |
saveToFile(java.lang.String path,
java.lang.String fileName,
byte[] data)
Save binary data to a local file If the given path doesn't exist, it will be created |
static void |
saveToStream(java.io.DataOutputStream os,
byte[] data)
Send binary data to an output stream |
static void |
saveToStream(java.io.DataOutputStream os,
byte[] data,
ProgressCounter counter)
Send binary data to an output stream |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileUtils()
Method Detail |
---|
public static byte[] getBytesFromFile(java.lang.String fileName) throws java.io.IOException, OberonException
fileName
- the full path of local file
java.io.IOException
OberonException
public static byte[] getBytesFromStream(java.io.DataInputStream is) throws java.io.IOException, OberonException
java.io.IOException
OberonException
public static byte[] getBytesFromStream(java.io.DataInputStream is, ProgressCounter counter) throws java.io.IOException, OberonException
java.io.IOException
OberonException
public static void createLocalDir(java.lang.String path) throws OberonException
path
- the full path (all intermediate dirs will be created)
OberonException
public static java.io.File saveToFile(java.lang.String path, java.lang.String fileName, byte[] data) throws java.io.IOException, OberonException
path
- the full path of directory where save the filefileName
- the file namedata
- the binary data
java.io.IOException
OberonException
createLocalDir(String)
public static void saveToStream(java.io.DataOutputStream os, byte[] data) throws java.io.IOException, OberonException
java.io.IOException
OberonException
public static void saveToStream(java.io.DataOutputStream os, byte[] data, ProgressCounter counter) throws java.io.IOException, OberonException
java.io.IOException
OberonException
public static void copyFile(java.io.File inputFile, java.lang.String toPath, java.lang.String toName, boolean move) throws java.io.IOException, OberonException
inputFile
- the source filetoPath
- the destination full-pathtoName
- the destination file namemove
- if true, remove the source file
java.io.IOException
OberonException
public static java.util.Vector<java.lang.String> listFiles(java.lang.String path, boolean subdirs)
path
- the directory full pathsubdirs
- if true recurse to sub directories
public static java.util.Vector<java.lang.String> listFiles(java.lang.String path)
path
- the directory full path
public static void cleanDirs(java.lang.String path)
public static void removeLocalDir(java.lang.String path)
public static com.oberon.ooql.ftp.FTPClient connectFTP(java.lang.String host, int port, java.lang.String user, java.lang.String password) throws OberonException
host
- the host name or IP addressport
- the FTP portuser
- the user accountpassword
- the user account password
OberonException
public static void getFTPFile(java.lang.String host, int port, java.lang.String user, java.lang.String password, java.lang.String path, java.lang.String fileName, java.lang.String toPath, java.lang.String toName, boolean move) throws OberonException
host
- the host name or IP addressport
- the FTP portuser
- the user accountpassword
- the user account passwordpath
- the FTP file full-pathfileName
- the FTP file nametoPath
- the local full-pathtoName
- the local file namemove
- if true, remove the source FTP file
OberonException
public static void getFTPFile(java.lang.String host, int port, java.lang.String user, java.lang.String password, java.lang.String path, java.lang.String fileName, java.lang.String toPath, java.lang.String toName, boolean move, com.oberon.ooql.ftp.FTPDataTransferListener listener) throws OberonException
host
- the host name or IP addressport
- the FTP portuser
- the user accountpassword
- the user account passwordpath
- the FTP file full-pathfileName
- the FTP file nametoPath
- the local full-pathtoName
- the local file namemove
- if true, remove the source FTP filelistener
- data transfer listener
OberonException
public static void putFTPFile(java.lang.String host, int port, java.lang.String user, java.lang.String password, java.io.File sourceFile, java.lang.String toPath, java.lang.String toName, boolean move) throws OberonException
host
- the host name or IP addressport
- the FTP portuser
- the user accountpassword
- the user account passwordsourceFile
- the local filetoPath
- the destination FTP full-pathtoName
- the destination file namemove
- if true, remove the source local file
OberonException
public static void putFTPFile(java.lang.String host, int port, java.lang.String user, java.lang.String password, java.io.File sourceFile, java.lang.String toPath, java.lang.String toName, boolean move, com.oberon.ooql.ftp.FTPDataTransferListener listener) throws OberonException
host
- the host name or IP addressport
- the FTP portuser
- the user accountpassword
- the user account passwordsourceFile
- the local filetoPath
- the destination FTP full-pathtoName
- the destination file namemove
- if true, remove the source local filelistener
- data transfer listener
OberonException
public static void moveFTPFile(java.lang.String host, int port, java.lang.String user, java.lang.String password, java.lang.String fromFile, java.lang.String toPath, java.lang.String toName) throws OberonException
host
- the host name or IP addressport
- the FTP portuser
- the user accountpassword
- the user account passwordfromFile
- the FTP full path file nametoPath
- the destination FTP full-pathtoName
- the destination file name
OberonException
public static void deleteFTPFile(java.lang.String host, int port, java.lang.String user, java.lang.String password, java.lang.String fileName) throws OberonException
host
- the host name or IP addressport
- the FTP portuser
- the user accountpassword
- the user account passwordfileName
- the FTP full path file name to delete
OberonException
public static java.util.Vector<java.lang.String> listFTPFiles(java.lang.String host, int port, java.lang.String user, java.lang.String password, java.lang.String path) throws OberonException
host
- the host name or IP addressport
- the FTP portuser
- the user accountpassword
- the user account passwordpath
- the directory full path
OberonException
public static void cleanFTPDirs(com.oberon.ooql.ftp.FTPClient client, java.lang.String path) throws java.lang.Exception
java.lang.Exception
public static com.oberon.ooql.sdk.common.WebServiceClient connectHTTP(java.lang.String url, java.lang.String user, java.lang.String password) throws OberonException
url
- the url of the webservice for file manipulationuser
- the user accountpassword
- the user account password
OberonException
public static void getHTTPFile(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String path, java.lang.String fileName, java.lang.String toPath, java.lang.String toName, boolean move) throws OberonException
url
- the url of the webservice for file manipulationuser
- the user accountpassword
- the user account passwordpath
- the HTTP file full-pathfileName
- the HTTP file nametoPath
- the local full-pathtoName
- the local file namemove
- if true, remove the source HTTP file
OberonException
public static void putHTTPFile(java.lang.String url, java.lang.String user, java.lang.String password, java.io.File sourceFile, java.lang.String toPath, java.lang.String toName, boolean move) throws OberonException
url
- the url of the webservice for file manipulationuser
- the user accountpassword
- the user account passwordsourceFile
- the local filetoPath
- the destination HTTP full-pathtoName
- the destination file namemove
- if true, remove the source local file
OberonException
public static void moveHTTPFile(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String fromFile, java.lang.String toPath, java.lang.String toName) throws OberonException
url
- the url of the webservice for file manipulationuser
- the user accountpassword
- the user account passwordfromFile
- the HTTP full path file nametoPath
- the destination HTTP full-pathtoName
- the destination file name
OberonException
public static void deleteHTTPFile(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String fileName) throws OberonException
url
- the url of the webservice for file manipulationuser
- the user accountpassword
- the user account passwordfileName
- the HTTP full path file name to delete
OberonException
public static java.util.Vector<java.lang.String> listHTTPFiles(java.lang.String url, java.lang.String user, java.lang.String password, java.lang.String path) throws OberonException
url
- the url of the webservice for file manipulationuser
- the user accountpassword
- the user account passwordpath
- the directory full path
OberonException
public static void cleanHTTPDirs(com.oberon.ooql.sdk.common.WebServiceClient client, java.lang.String path) throws java.lang.Exception
java.lang.Exception
|
OBEROn SDK | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |