org.directwebremoting.io
Class FileTransfer

java.lang.Object
  extended by org.directwebremoting.io.FileTransfer

public class FileTransfer
extends java.lang.Object

One of the 2 ways you can receive uploaded files from a DWR enabled page is to expose a method with a FileTransfer parameter. The other is to expose a method with an InputStream parameter.

Author:
Lance Semmens [uklance at gmail dot com], Joe Walker [joe at getahead dot ltd dot uk]

Constructor Summary
FileTransfer(java.lang.String name, java.lang.String mimeType, byte[] data)
          A ctor for the 3 things browsers tell us about the uploaded file
FileTransfer(java.lang.String name, java.lang.String mimeType, java.io.InputStream inputStream)
          A ctor for the 3 things browsers tell us about the uploaded file
 
Method Summary
 java.io.InputStream getInputStream()
          Returns an InputStream that can be used to retrieve the contents of the file.
 java.lang.String getMimeType()
          Returns the content type passed by the browser or null if not defined.
 java.lang.String getName()
          Returns the original filename in the client's file-system, as provided by the browser (or other client software).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileTransfer

public FileTransfer(java.lang.String name,
                    java.lang.String mimeType,
                    java.io.InputStream inputStream)
A ctor for the 3 things browsers tell us about the uploaded file

Parameters:
name - The remote source filename
mimeType - The mime type passed in by the browser
inputStream - A means by which the data can be read

FileTransfer

public FileTransfer(java.lang.String name,
                    java.lang.String mimeType,
                    byte[] data)
A ctor for the 3 things browsers tell us about the uploaded file

Parameters:
name - The remote source filename
mimeType - The mime type passed in by the browser
data - The data to be transfered
Method Detail

getMimeType

public java.lang.String getMimeType()
Returns the content type passed by the browser or null if not defined.

Returns:
The content type passed by the browser or null if not defined.

getInputStream

public java.io.InputStream getInputStream()
Returns an InputStream that can be used to retrieve the contents of the file.

Returns:
An InputStream that can be used to retrieve the contents of the file.

getName

public java.lang.String getName()
Returns the original filename in the client's file-system, as provided by the browser (or other client software). In most cases, this will be the base file name, without path information. However, some clients, such as the Opera browser, do include path information.

Returns:
The original filename in the client's file-system.

Copyright ¬ 2005