Mercurial Hosting > luan
comparison src/luan/lib/Utils.java @ 161:d310ebf4d6e7
add javaSearcher
git-svn-id: https://luan-java.googlecode.com/svn/trunk@162 21e917c8-12df-6dd8-5cb6-c86387c605b9
author | fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9> |
---|---|
date | Thu, 19 Jun 2014 10:44:20 +0000 |
parents | fcb81fa2df0d |
children |
comparison
equal
deleted
inserted
replaced
160:138b9baee80b | 161:d310ebf4d6e7 |
---|---|
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) { | |
56 try { | |
57 return file.exists() && file.getName().equals(file.getCanonicalFile().getName()); | |
58 } catch(IOException e) { | |
59 throw new RuntimeException(e); | |
60 } | |
61 } | |
62 | |
55 public static boolean isFile(String path) { | 63 public static boolean isFile(String path) { |
56 return new File(path).exists(); | 64 return exists(new File(path)); |
57 } | 65 } |
58 | 66 |
59 public static String toUrl(String path) { | 67 public static String toUrl(String path) { |
60 if( path.indexOf(':') == -1 ) | 68 if( path.indexOf(':') == -1 ) |
61 return null; | 69 return null; |