标签:style blog io ar color os 使用 sp for
private static void parsePdfFile(String file) throws Exception { FileInputStream fis = new FileInputStream(file); PDFParser pdfParser = new PDFParser(fis); pdfParser.parse(); COSDocument cosDocument = pdfParser.getDocument(); List<COSObject> objList = cosDocument.getObjects(); for (COSObject obj : objList) { COSBase cosBase = obj.getItem(COSName.SUBTYPE); if (null != cosBase && cosBase instanceof COSName) { String strName = cosBase.toString(); if ("COSName{application/x-shockwave-flash}".equals(strName)) { COSStream cosStream = COSUtils.getAsStream(obj, cosDocument); InputStream inputStream = cosStream.getUnfilteredStream(); String strOutFile = String.format("/tmp/%s.swf", new Date().getTime()); FileOutputStream fileOutputStream = new FileOutputStream(strOutFile); byte[] bytes = new byte[10240]; int iRead; while (true) { iRead = inputStream.read(bytes); if (iRead <= 0) { break; } fileOutputStream.write(bytes, 0, iRead); } fileOutputStream.close(); inputStream.close(); } } }
标签:style blog io ar color os 使用 sp for
原文地址:http://www.cnblogs.com/byshome/p/4163990.html