OSDN Git Service

5.3.5-SNAPSHOT
[importpicture/importpicture.git] / src / test / java / osm / jp / gpx / ImportPictureTest.java
index fbec0f1..ebcf388 100644 (file)
@@ -43,13 +43,26 @@ public class ImportPictureTest {
         UnZip.uncompress(new File(dataset.tarFilePath), new File("target/test-classes/cameradata"));
 
         // GPXファイルをセット
-        try (FileInputStream inStream = new FileInputStream(new File(dataset.gpxSourcePath));
-            FileOutputStream outStream = new FileOutputStream(new File(dataset.gpxDestinationPath));
-            FileChannel inChannel = inStream.getChannel();
-            FileChannel outChannel = outStream.getChannel())
-        {
-            inChannel.transferTo(0, inChannel.size(), outChannel);
-        }
+        //copy(new File(dataset.gpxSourcePath), new File(dataset.gpxDestinationPath));
+    }
+    
+    void copy(File source, File dest) throws IOException {
+       if (source.isDirectory()) {
+               File[] files = source.listFiles();
+               for (int i = 0; i < files.length; i++) {
+                               File file = files[i];
+                               copy(file, dest);
+                       }
+       }
+       else {
+            try (FileInputStream inStream = new FileInputStream(source);
+                FileOutputStream outStream = new FileOutputStream(dest);
+                FileChannel inChannel = inStream.getChannel();
+                FileChannel outChannel = outStream.getChannel())
+            {
+                inChannel.transferTo(0, inChannel.size(), outChannel);
+            }
+       }
     }
 
     /**