把别人的代码copy过来用,大家帮看看,下面的可以用吗?直接传入一组clipID,可以保存在本地吗?public void retrieveContent(String clipID, HttpServletResponse response)
throws Exception
{ int exitCode = 0;
FPPool thePool = null;
try
{ FPPool.setGlobalOption(FPLibraryConstants.FP_OPTION_OPENSTRATEGY,
FPLibraryConstants.FP_LAZY_OPEN); FPPool.setGlobalOption(FPLibraryConstants.FP_OPTION_OPENSTRATEGY,
FPLibraryConstants.FP_LAZY_OPEN); thePool = new FPPool(poolAddress); FPClip theClip = new FPClip(thePool, clipID,
FPLibraryConstants.FP_OPEN_FLAT); FPTag topTag = theClip.getTopTag();
String origFilename = topTag.getStringAttribute("filename"); response.setContentType("application/x-msdownload");
response.setHeader("Content-disposition", "attachment; filename="
+ new String(origFilename.getBytes("gb2312"), "iso8859-1")); topTag.BlobRead(response.getOutputStream()); topTag.Close();
theClip.Close(); }
catch (FPLibraryException e)
{
exitCode = e.getErrorCode();
System.err.println("Centera SDK Error: " + e.getMessage() + "("
+ exitCode + ")");
}
catch (IllegalArgumentException e)
{
System.out.println(e.getMessage());
e.printStackTrace();
exitCode = -1;
}
catch (IOException e)
{
System.err.println("IO Error occured: " + e.getMessage());
e.printStackTrace();
exitCode = -1;
}
finally
{
thePool.Close();
}
}
throws Exception
{ int exitCode = 0;
FPPool thePool = null;
try
{ FPPool.setGlobalOption(FPLibraryConstants.FP_OPTION_OPENSTRATEGY,
FPLibraryConstants.FP_LAZY_OPEN); FPPool.setGlobalOption(FPLibraryConstants.FP_OPTION_OPENSTRATEGY,
FPLibraryConstants.FP_LAZY_OPEN); thePool = new FPPool(poolAddress); FPClip theClip = new FPClip(thePool, clipID,
FPLibraryConstants.FP_OPEN_FLAT); FPTag topTag = theClip.getTopTag();
String origFilename = topTag.getStringAttribute("filename"); response.setContentType("application/x-msdownload");
response.setHeader("Content-disposition", "attachment; filename="
+ new String(origFilename.getBytes("gb2312"), "iso8859-1")); topTag.BlobRead(response.getOutputStream()); topTag.Close();
theClip.Close(); }
catch (FPLibraryException e)
{
exitCode = e.getErrorCode();
System.err.println("Centera SDK Error: " + e.getMessage() + "("
+ exitCode + ")");
}
catch (IllegalArgumentException e)
{
System.out.println(e.getMessage());
e.printStackTrace();
exitCode = -1;
}
catch (IOException e)
{
System.err.println("IO Error occured: " + e.getMessage());
e.printStackTrace();
exitCode = -1;
}
finally
{
thePool.Close();
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货