com.uwyn.rife.test
Class MockFileUpload

java.lang.Object
  extended by com.uwyn.rife.test.MockFileUpload

public class MockFileUpload
extends Object

An instance of this class provides all the data that is needed to simulate a file upload.

Since:
1.1
Version:
$Revision: 3634 $
Author:
Geert Bevin (gbevin[remove] at uwyn dot com)

Constructor Summary
MockFileUpload(File file)
          Creates a new file upload simulation based on a File object.
MockFileUpload(File file, String contentType)
          Creates a new file upload simulation based on a File object.
MockFileUpload(String fileName, InputStream inputStream, String contentType)
          Creates a new file upload simulation based on an InputStream.
 
Method Summary
 String getContentType()
          Returns the content type associated with this file upload simulation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockFileUpload

public MockFileUpload(File file)
Creates a new file upload simulation based on a File object.

The content type will be guessed from the file extension. The extension to mime-type mapping is retrieved from RifeConfig.Mime.

Parameters:
file - the file that will be uploaded
Since:
1.1

MockFileUpload

public MockFileUpload(File file,
                      String contentType)
Creates a new file upload simulation based on a File object.

Parameters:
file - the file that will be uploaded
contentType - the content type of the file
Since:
1.1

MockFileUpload

public MockFileUpload(String fileName,
                      InputStream inputStream,
                      String contentType)
Creates a new file upload simulation based on an InputStream.

Parameters:
fileName - the name of file that will be uploaded
inputStream - the input stream that will be read to provide the content of the uploaded file
contentType - the content type of the uploaded file
Since:
1.1
Method Detail

getContentType

public String getContentType()
Returns the content type associated with this file upload simulation.

If no content type has been provided, and it could not be detected automatically, then it defaults to text/plain.

Returns:
the content type
Since:
1.1


Copyright © 2001-2007 Uwyn sprl/bvba. All Rights Reserved.