|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.mindprod.filetransfer.MiniFileTransfer
public class MiniFileTransfer
copy a file, typically from a resource in a jar to the hard disk.
To read or write from the client's local hard disk in an Applet, 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.
Constructor Summary | |
---|---|
MiniFileTransfer()
constructor |
|
MiniFileTransfer(int buffSize)
constructor |
Method Summary | |
---|---|
boolean |
copy(java.io.InputStream source,
java.io.File target)
copy a file from a stream, typically a resource in the archive jar file to a local file on hard disk. |
boolean |
copy(java.io.InputStream source,
java.io.OutputStream target,
boolean closeTarget)
Copy an InputStream to an OutputStream, until EOF. |
boolean |
copy(java.util.zip.ZipFile sourceJar,
java.lang.String zipEntryString,
java.io.File target)
Copy a file from a resource in some a local jar file, not the archive, to a local file on hard disk. |
static void |
main(java.lang.String[] args)
dummy main |
void |
setConnectTimeout(int connectTimeout)
override the default connect timeout of 50 seconds |
void |
setReadTimeout(int readTimeout)
override the default read timeout of 40 seconds |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MiniFileTransfer()
public MiniFileTransfer(int buffSize)
buffSize
- how big the I/O chunks are to copy files.Method Detail |
---|
public boolean copy(java.io.InputStream source, java.io.File target)
source
- resource as stream e.g. this.class.getResourceAsStream("lyrics.ram"); Netscape interferes with
extensions *.exe, *.dll etc. So use *.ram for your resources.target
- new file to be created on local hard disk.
public boolean copy(java.io.InputStream source, java.io.OutputStream target, boolean closeTarget)
source
- InputStream, always left closedtarget
- OutputStreamcloseTarget
- true if you want target stream closed when done. false, leave the target open for more I/O.
public boolean copy(java.util.zip.ZipFile sourceJar, java.lang.String zipEntryString, java.io.File target)
sourceJar
- ZipFile e.g. new ZipFile("stuff.jar"), left open.zipEntryString
- fully qualified name of ZipEntry e.g. "com/mindprod/mypack/Stuff.html". Note this is a
String, not a ZipEntry.target
- new file to be created on local hard disk.
public void setConnectTimeout(int connectTimeout)
connectTimeout
- timeout to connect in ms. Note int not long.public void setReadTimeout(int readTimeout)
readTimeout
- timeout to connect int ms. Note int not long.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 |