package org.tizen.emulator.manager.vms;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.nio.channels.FileChannel;
import org.tizen.emulator.manager.tool.FileIO;
if(oldVM.equals(newVM)) {// if nothing if modified...
return;
}
-
if (!newVM.resolution.equals(oldVM.resolution)) {
int i = newVM.resolution.indexOf('x');
throw new VMsWorkerException("Create new image path is failed !");
}
- FileReader in = null;
- FileWriter out = null;
+
+ FileInputStream inputStream = null;
+ FileOutputStream outputStream = null;
+ FileChannel fcin = null;
+ FileChannel fcout = null;
try {
- in = new FileReader(src);
- out = new FileWriter(dest);
+ inputStream = new FileInputStream(src);
+ outputStream = new FileOutputStream(dest);
- int c;
- while((c = in.read()) != -1) {
- out.write(c);
- }
+ fcin = inputStream.getChannel();
+ fcout = outputStream.getChannel();
+ long size = fcin.size();
+ fcin.transferTo(0, size, fcout);
} catch (FileNotFoundException e) {
throw new VMsWorkerException("SD Card image create failed!\n" + e.getMessage());
} catch (IOException e) {
throw new VMsWorkerException("SD Card image create failed!\n" + e.getMessage());
}finally {
try {
- if (in != null) in.close();
- if (out != null) out.close();
+ if (fcout != null)
+ fcout.close();
+ if (fcin != null)
+ fcin.close();
+ if (outputStream != null)
+ outputStream.close();
+ if (inputStream != null)
+ inputStream.close();
} catch (IOException e) {
throw new VMsWorkerException(e.getMessage());
}
return false;
if(this.keyType != dest.keyType)
return false;
- if(this.isSDCardSupport != dest.isSDCardSupport)
+ if(this.isSDCardSupport != dest.isSDCardSupport) {
return false;
+ } else {
+ if (!this.SDCardPath.equals(dest.SDCardPath))
+ return false;
+ }
if(this.ramSize != dest.ramSize)
return false;
- if(this.isFileShareSupport != dest.isFileShareSupport)
+ if(this.isFileShareSupport != dest.isFileShareSupport) {
return false;
+ } else {
+ if (!this.fileSharePath.equals(dest.fileSharePath))
+ return false;
+ }
if (this.isHWVirtualization != dest.isHWVirtualization)
return false;