return null;
}
try
{
final FormField formField = data.getFormField();
if (paramType == FileTransfer.class)
{
InputStreamFactory inFactory = new InputStreamFactory()
{
public InputStream getInputStream() throws IOException
{
return formField.getInputStream();
}
public void close() throws IOException
{
formField.getInputStream().close();
}
};
return new FileTransfer(formField.getName(), formField.getMimeType(), formField.getFileSize(), inFactory);
}
else if (paramType == InputStream.class)
{
return formField.getInputStream();
}
else if (paramType == BufferedImage.class)
{
return ImageIO.read(formField.getInputStream());
}
else if (paramType.isArray() && paramType.getComponentType() == Byte.TYPE)
{
InputStream in = formField.getInputStream();
ByteArrayOutputStream out = new ByteArrayOutputStream();
CopyUtils.copy(in, out);
return out.toByteArray();
}
}