All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class EDU.bmrb.net.BmrbFileGetSend

java.lang.Object
   |
   +----EDU.bmrb.net.BmrbFileGetSend

public class BmrbFileGetSend
extends Object

Variable Index

 o cgiURL

Constructor Index

 o BmrbFileGetSend(URL)
Constructor: Creates the URL for the file_get_send CGI program, by using this applets' document base string.

Method Index

 o delFile(String)
This method deletes the specified file from the host
 o getFile(String)
This method gets the specified file, and generates a new String containing the contents of the file.
 o sendFile(String, byte[])
This method sends the file's contents from a string variable.

Variables

 o cgiURL
 protected URL cgiURL

Constructors

 o BmrbFileGetSend
 public BmrbFileGetSend(URL docBase) throws MalformedURLException, IOException
Constructor: Creates the URL for the file_get_send CGI program, by using this applets' document base string. If you call this constructor from within an applet, you can use the applet's getDocumentBase() method to retrieve this URL.

Parameters:
docBase - the URL of the applet's documentation page in which this is being run.
Throws: MalformedURLException
thrown if the URL docBase string is not valid URL syntax.

Methods

 o sendFile
 public void sendFile(String remoteFName,
                      byte fileContents[]) throws IOException, HTTPException
This method sends the file's contents from a string variable. An example of using it is:
     bmrbFileGetSend handle = [...snip...];
     [...snip...]
     handle.sendFile( "filename.txt",
                      "This is\nThe file's\nContents.\n" );
 

Parameters:
remoteFName - The name of the file to be stored on the host. Be sure to keep it unique.
fileContents - The contents of the file to send to the host.
Throws: IOException
thrown by a number of possible I/O errors.
Throws: HTTPException
if the HTTP response from the server was anything other than "200 OK", this is thrown and the status string is in "getMessage()".
 o getFile
 public byte[] getFile(String remoteFName) throws IOException, HTTPException
This method gets the specified file, and generates a new String containing the contents of the file.

Parameters:
remoteFName - the name of the file to be retrieved from the host.
Returns:
A new byte array containing the contents of the file.
Throws: IOException
thrown if there are any I/O errors.
Throws: HTTPException
if the HTTP response from the server was anything other than "200 OK", this is thrown and the status string is in "getMessage()".
 o delFile
 public void delFile(String remoteFName) throws IOException, HTTPException
This method deletes the specified file from the host

Parameters:
remoteFName - the name of the file to be removed from the host.
Throws: IOExcpetion
when some I/O error happened in the traffic.
Throws: HTTPException
when the "HTTP/1.0 XXX ..." string returned indicates some error. The getMessage() field of the exception contains the errror message returned.

All Packages  Class Hierarchy  This Package  Previous  Next  Index