|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.filetransfer.MiniFileTransfer
com.mindprod.filetransfer.FileTransfer
public class FileTransfer
classes to copy, and download files.
To read or write from the client's local hard disk, you will need a signed Applet and security clearance. see Signed Applet in the Java glossary. To read a files from the server, the file must be given public read access, usually the default. To write a file to the server, you server will have to support CGI-PUT with public access. This is unusual to find. Normally you upload files with FTP. See FTP in the Java glossary. See also the simpler hunkio package.
Field Summary | |
---|---|
static java.lang.String |
EMBEDDED_COPYRIGHT
undisplayed copyright notice |
static java.lang.String |
VERSION_STRING
embedded version string. |
Constructor Summary | |
---|---|
FileTransfer()
constructor |
|
FileTransfer(int buffSize)
constructor |
Method Summary | |
---|---|
boolean |
append(java.io.File source,
java.io.File target)
append a file onto the end of another. |
boolean |
copy(java.io.File source,
java.io.OutputStream target,
boolean closeTarget)
Copy a file to an OutputStream |
boolean |
copy(java.io.InputStream source,
java.io.OutputStream target,
long length,
boolean closeTarget)
Copy an InputStream to an OutputStream when you know the length in advance. |
boolean |
download(java.net.URL source,
java.io.File target)
Copy a file from a remote URL to a local file on hard disk. |
static void |
main(java.lang.String[] args)
dummy main |
protected void |
setStandardProperties(java.net.URLConnection urlc)
set up the standard properties on the connection. |
Methods inherited from class com.mindprod.filetransfer.MiniFileTransfer |
---|
copy, copy, copy, setConnectTimeout, setReadTimeout |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String EMBEDDED_COPYRIGHT
public static final java.lang.String VERSION_STRING
Constructor Detail |
---|
public FileTransfer()
public FileTransfer(int buffSize)
buffSize
- how big the I/O chunks are to copy files.Method Detail |
---|
public boolean append(java.io.File source, java.io.File target)
source
- file to copy on local hard disk.target
- file that will become larger by having source appended to the end of it.
It need not exist. Source and target must be using the same encoding.
public boolean copy(java.io.File source, java.io.OutputStream target, boolean closeTarget)
source
- file to copy on local hard disk.target
- OutputStream to copy the file to.closeTarget
- true if the target OutputStream should be closed when we are done. false if the target
OutputStream should be left open for further output when done.
public boolean copy(java.io.InputStream source, java.io.OutputStream target, long length, boolean closeTarget)
source
- InputStream, left closed.target
- OutputStream, left closed.length
- how many bytes to copy, -1 if you don't know.closeTarget
- true if you want the target stream closed when done. false if you want to the target
stream left open for further output.
public boolean download(java.net.URL source, java.io.File target)
source
- remote URL to copy. e.g. new URL("http://www.billabong.com:80/songs/lyrics.txt")
works with http:, https:, file: and possibly others.target
- new file to be created on local hard disk.
protected void setStandardProperties(java.net.URLConnection urlc)
urlc
- Connection we are setting up.public static void main(java.lang.String[] args)
args
- not used source url, target file
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |