comparison core/src/luan/modules/Utils.java @ 237:97d175772fed

implement mmake git-svn-id: https://luan-java.googlecode.com/svn/trunk@238 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Mon, 06 Oct 2014 04:07:56 +0000
parents f9e3e64132e1
children 705d14f4d8ee
comparison
equal deleted inserted replaced
236:1fada5587469 237:97d175772fed
49 { 49 {
50 ByteArrayOutputStream out = new ByteArrayOutputStream(); 50 ByteArrayOutputStream out = new ByteArrayOutputStream();
51 copyAll(in,out); 51 copyAll(in,out);
52 return out.toByteArray(); 52 return out.toByteArray();
53 } 53 }
54 54 /*
55 public static boolean exists(File file) { 55 public static boolean exists(File file) {
56 try { 56 try {
57 return file.exists() && file.getName().equals(file.getCanonicalFile().getName()); 57 return file.exists() && file.getName().equals(file.getCanonicalFile().getName());
58 } catch(IOException e) { 58 } catch(IOException e) {
59 throw new RuntimeException(e); 59 throw new RuntimeException(e);
60 } 60 }
61 } 61 }
62 62 */
63 public static File toFile(String path) { 63 public static File toFile(String path) {
64 if( path.contains("//") ) 64 if( path.contains("//") )
65 return null; 65 return null;
66 File file = new File(path); 66 File file = new File(path);
67 return exists(file) ? file : null; 67 return file.exists() ? file : null;
68 } 68 }
69 69
70 public static URL toUrl(String path) { 70 public static URL toUrl(String path) {
71 if( path.indexOf(':') == -1 ) 71 if( path.indexOf(':') == -1 )
72 return null; 72 return null;