Browse Source

Update NodeAgent.java

o2null 5 years ago
parent
commit
eba016867e

+ 1 - 38
o2server/x_console/src/main/java/com/x/server/console/NodeAgent.java

@@ -121,7 +121,7 @@ public class NodeAgent extends Thread {
 								fos.flush();
 								fos.flush();
 							}
 							}
 							fos.close();
 							fos.close();
-							bytes = toByteArray(file);
+							bytes = IOUtils.xxxx(file);
 							filename = filename.substring(0,filename.lastIndexOf("."));
 							filename = filename.substring(0,filename.lastIndexOf("."));
 			                //部署
 			                //部署
 							String result = this.redeploy(filename, bytes);
 							String result = this.redeploy(filename, bytes);
@@ -189,43 +189,6 @@ public class NodeAgent extends Thread {
 		}
 		}
 	}
 	}
 
 
-	 /** 
-     * 读取文件到byte []
-     *  
-     * @param filename 
-     * @return 
-     * @throws IOException 
-     */  
-    public static byte[] toByteArray(File f ) throws IOException {  
-       // File f = new File(filename);  
-        if (!f.exists()) {  
-            throw new FileNotFoundException(f.getName());  
-        }  
-  
-        ByteArrayOutputStream bos = new ByteArrayOutputStream((int) f.length());  
-        BufferedInputStream in = null;  
-        try {  
-            in = new BufferedInputStream(new FileInputStream(f));  
-            int buf_size = 1024;  
-            byte[] buffer = new byte[buf_size];  
-            int len = 0;  
-            while (-1 != (len = in.read(buffer, 0, buf_size))) {  
-                bos.write(buffer, 0, len);  
-            }  
-            return bos.toByteArray();  
-        } catch (IOException e) {  
-            e.printStackTrace();  
-            throw e;  
-        } finally {  
-            try {  
-                in.close();  
-            } catch (IOException e) {  
-                e.printStackTrace();  
-            }  
-            bos.close();  
-        }  
-    }  
-
 	private void readLog(long lastTimeFileSize, DataOutputStream dos) throws Exception{
 	private void readLog(long lastTimeFileSize, DataOutputStream dos) throws Exception{
 		try {
 		try {
 			File logFile = new File(Config.base(), "logs/" + DateTools.format(new Date(), "yyyy_MM_dd") + ".out.log");
 			File logFile = new File(Config.base(), "logs/" + DateTools.format(new Date(), "yyyy_MM_dd") + ".out.log");