|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface FileLoader
This interface defines a mechanism to load files from a server to the local machine. An interface is provide so multiple file loader implementations are possible.
| Method Summary | |
|---|---|
void |
connect(java.lang.String hostname,
java.lang.String port,
java.lang.String username,
java.lang.String password)
This method initiates a connection from the client to the server. |
void |
disconnect()
This method should terminate a connection to the server. |
long |
getFileSize(java.lang.String path,
java.lang.String filename)
This method should return the size of a file on the server |
boolean |
isConnected()
Determines if the file loader is connected to a server. |
byte[] |
loadFile(java.lang.String path,
java.lang.String filename,
int increment,
java.awt.event.ActionListener listener)
This method will load a file from the server into a byte array. |
int |
writeFile(java.io.File file,
int increment,
byte[] byteArray,
java.awt.event.ActionListener listener)
This method will write a file from a byte array. |
| Method Detail |
|---|
void connect(java.lang.String hostname,
java.lang.String port,
java.lang.String username,
java.lang.String password)
throws java.lang.Exception
hostname - The hostname to connect toport - The port to connect tousername - The username to log into the serverpassword - The password to log into the server
java.lang.Exception - if a successful connection could not be established.
void disconnect()
throws java.lang.Exception
java.lang.Exception - if the connection could not be properly terminated.boolean isConnected()
long getFileSize(java.lang.String path,
java.lang.String filename)
throws java.lang.Exception
path - The path to the file. All paths should be passed using a forward slash ("/") as a directory
seperator. If this parameter is null, the current working directory on the server will be assumed.filename - The filename on the server.
java.lang.Exception - if the file size could not be determined.
byte[] loadFile(java.lang.String path,
java.lang.String filename,
int increment,
java.awt.event.ActionListener listener)
throws java.lang.Exception
path - The path to the file. All paths should be passed using a forward slash ("/") as a directory
seperator. If this parameter is null, the current working directory on the server will be assumed.filename - The filename on the server.increment - The prefered number of bytes to read during each pass before the action listener is called. Note
that this parameter is a preference, but the actual number of bytes read during each pass is not guarunteed. A
parameter of 0 indicates no preference.listener - An action listener which will be notified whenever a portion of the file has been loaded. The
'command' part of this action event should contain the number of bytes which has been loaded since the last action
event. Although it is not required that intermediate events be generated, it is preferred so the caller has a
chance to provide user feedback. If this parameter is null, no action events will be generated.
java.lang.Exception - if the file could not be loaded.
int writeFile(java.io.File file,
int increment,
byte[] byteArray,
java.awt.event.ActionListener listener)
throws java.lang.Exception
file - The file to write to.increment - The prefered number of bytes to read during each pass before the action listener is called. Note
that this parameter is a preference, but the actual number of bytes read during each pass is not guarunteed. A
parameter of 0 indicates no preference.byteArray - The byte array of files to be written.listener - An action listener which will be notified whenever a portion of the file has been written. The
'command' part of this action event should contain the number of bytes which has been written since the last
action event. Although it is not required that intermediate events be generated, it is preferred so the caller
has a chance to provide user feedback. If this parameter is null, no action events will be generated.
java.lang.Exception - if the file could not be successfully written.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||