return new NonNestedOutboundVariable("null");
}
try
{
FileTransfer transfer;
if (object instanceof BufferedImage)
{
transfer = new FileTransfer((BufferedImage) object, "png");
}
else if (object instanceof InputStream)
{
final InputStream in = (InputStream) object;
transfer = new FileTransfer("download.dat", "binary/octet-stream", -1, new InputStreamFactory()
{
public InputStream getInputStream() throws IOException
{
return in;
}
public void close() throws IOException
{
in.close();
}
});
}
else if (object instanceof FileTransfer)
{
transfer = (FileTransfer) object;
}
else if (object.getClass().isArray() && object.getClass().getComponentType() == Byte.TYPE)
{
transfer = new FileTransfer("download.dat", "binary/octet-stream", (byte[]) object);
}
else
{
throw new ConversionException(object.getClass());
}