|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sptci.echo2.FileDownloadProvider
public class FileDownloadProvider
A download provider for streaming contents of a file to the client browser.
The following shows sample usage of this class:
import nextapp.echo2.app.filetransfer.Download;
import com.sptci.echo2.FileDownloadProvider;
...
File file = new File( "/tmp/test.java" );
FileDownloadProvider provider =
new FileDownloadProvider( file, "application/x-download" );
Download download = new Download();
download.setProvider( provider );
download.setActive( true );
Application.getActive().enqueueCommand( download );
Copyright 2006 Sans Pareil Technologies, Inc.
| Constructor Summary | |
|---|---|
FileDownloadProvider(File file,
String contentType)
Create a new instance of the provider for the specified file. |
|
FileDownloadProvider(String file,
String contentType)
Create a new instance of the provider for the specified file. |
|
| Method Summary | |
|---|---|
boolean |
fileExists()
Return true if the file points to a valid file. |
String |
getContentDisposition()
Returns the content-disposition for the file. |
String |
getContentType()
Returns the content type of the file. |
String |
getFileName()
Returns the file's name. |
String |
getPath()
Returns the file's fully qualified path. |
int |
getSize()
Returns the size of the file. |
void |
writeFile(OutputStream out)
Writes the file to the specified output stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public FileDownloadProvider(String file,
String contentType)
file - The file to use.contentType - The contentType to use.
public FileDownloadProvider(File file,
String contentType)
file - The file to use.contentType - The contentType to use.| Method Detail |
|---|
public String getContentType()
getContentType in interface nextapp.echo2.app.filetransfer.DownloadProviderpublic String getContentDisposition()
content-disposition for the file. Mandatory
method introduced in patched version of file transfer library. Sets
to inline to force browser to display if possible.
getContentDisposition in interface nextapp.echo2.app.filetransfer.DownloadProviderpublic String getFileName()
getFileName in interface nextapp.echo2.app.filetransfer.DownloadProviderpublic String getPath()
public int getSize()
getSize in interface nextapp.echo2.app.filetransfer.DownloadProviderpublic boolean fileExists()
file points to a valid file.
true if the file exists.
public void writeFile(OutputStream out)
throws IOException
writeFile in interface nextapp.echo2.app.filetransfer.DownloadProviderout - The output stream to which the file should be written.
IOException - If the provider is unable to perform this operation.
|
SPT Core API | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||