Utility: Add file copy function.
authorminkee.lee <minkee.lee@samsung.com>
Wed, 29 Oct 2014 10:35:57 +0000 (19:35 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Thu, 30 Oct 2014 06:31:44 +0000 (15:31 +0900)
Change-Id: I688a1c64797de9f9ddf36e44ee03b83e9ea57e27
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
common-project/src/org/tizen/emulator/manager/resources/FilePathResources.java
common-project/src/org/tizen/emulator/manager/vms/helper/HelperClass.java

index 3c26429..e932904 100644 (file)
@@ -482,4 +482,8 @@ public class FilePathResources {
        public static String getEmulatorPath() {
                return emulatorPath;
        }
+
+       public static String getResourceSuffix() {
+               return resource_suffix;
+       }
 }
index 8940d0e..489ff5e 100644 (file)
 
 package org.tizen.emulator.manager.vms.helper;
 
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
 import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.net.ConnectException;
 import java.net.Inet6Address;
@@ -243,5 +248,45 @@ public class HelperClass {
                return loaclIPAddress;
        }
 
+       public static void FileCopy(File source, File dest) throws IOException {
+
+               FileInputStream inputStream = null;
+               FileOutputStream outputStream = null;
+               BufferedInputStream bin = null;
+               BufferedOutputStream bout = null;
+
+               try {
+                       inputStream = new FileInputStream(source);
+                       outputStream = new FileOutputStream(dest);
+
+                       bin = new BufferedInputStream(inputStream);
+                       bout = new BufferedOutputStream(outputStream);
+
+                       int bytesRead = 0;
+                       byte[] buffer = new byte[1024];
+                       while ((bytesRead = bin.read(buffer, 0, 1024)) != -1) {
+                               bout.write(buffer, 0, bytesRead);
+                       }
+
+               } catch (IOException e) {
+                       throw e;
+
+               } finally {
+                       if (bout != null) {
+                               bout.close();
+                       }
+                       if (bin != null) {
+                               bin.close();
+                       }
+                       if (outputStream != null) {
+                               outputStream.close();
+                       }
+                       if (inputStream != null) {
+                               inputStream.close();
+                       }
+               }
+
+       }
+
 }