Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. @Test
  2. public void testPoiFileCopy() {
  3.  
  4. String inputFile = "test/input/データ.xls";
  5. String outputFile = "test/output/データ2.xls";
  6. try {
  7. FileInputStream fis = new FileInputStream(inputFile);
  8. HSSFWorkbook wb = new HSSFWorkbook(fis);
  9. FileOutputStream fos = new FileOutputStream(outputFile);
  10. // ブックを書き込む
  11. wb.write(fos);
  12. fos.close();
  13. wb.close();
  14. fis.close();
  15.  
  16. assertTrue(Files.isSameFile(Paths.get(inputFile), Paths.get(outputFile)));
  17.  
  18. } catch (FileNotFoundException e) {
  19. e.printStackTrace();
  20. } catch (IOException e) {
  21. e.printStackTrace();
  22. } finally {
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement