Advertisement
Guest User

Untitled

a guest
May 24th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. /**
  2. * PDFファイルを結合する
  3. */
  4. ByteArrayOutputStream baos = new ByteArrayOutputStream();
  5. //PDF結合処理
  6. baos = pdfCombine(ufilePath, filelst,sfilePath,dto.t3Savefilename);
  7.  
  8. BufferedInputStream in = null;
  9. BufferedOutputStream out = null;
  10.  
  11. 以下中略
  12. 以下中略
  13.  
  14. ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
  15. //結合PDFをダウンロードに表示
  16. in = new BufferedInputStream(bais);
  17. out = new BufferedOutputStream(response.getOutputStream()); //レスポンスに書き込む
  18. byte buf[] = new byte[1024];
  19. int len;
  20. while ((len = in.read(buf)) != -1) {
  21. out.write(buf, 0, len);
  22. }
  23. out.flush();
  24. bais.close();
  25.  
  26.  
  27. } catch (UnsupportedEncodingException e) {
  28. // TODO 自動生成された catch ブロック
  29. e.printStackTrace();
  30. } catch (IOException e) {
  31. // TODO 自動生成された catch ブロック
  32. e.printStackTrace();
  33. } finally {
  34. if (in != null) {
  35. in.close();
  36. }
  37. if (out != null) {
  38. out.close();
  39. }
  40. }
  41. return null;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement