|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.foxsmart.ic.io.FileLoaderImpl
com.foxsmart.ic.io.HttpFileLoader
public class HttpFileLoader
This class provides a FileLoader which uses the HTTP protocol as the mechanism to load files from a server.
| Constructor Summary | |
|---|---|
HttpFileLoader()
|
|
| Method Summary | |
|---|---|
void |
connect(java.lang.String hostname,
java.lang.String port,
java.lang.String username,
java.lang.String password)
This method determines if the server is accessible. |
void |
disconnect()
Disconnects from server. |
long |
getFileSize(java.lang.String path,
java.lang.String filename)
This method returns the size of a given 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. |
static void |
main(java.lang.String[] args)
Test Driver. |
| Methods inherited from class com.foxsmart.ic.io.FileLoaderImpl |
|---|
createFileLoader, loadFile, writeFile |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HttpFileLoader()
| Method Detail |
|---|
public 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.
public void disconnect()
throws java.lang.Exception
java.lang.Exception - if the connection could not be properly terminated.public boolean isConnected()
public 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.
public 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.public static void main(java.lang.String[] args)
args - the arguments
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||