diff src/luan/modules/Utils.java @ 1367:836e00bf7ce2

add Lucene backup_to
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 18 Jun 2019 16:27:03 -0600
parents 1a68fc55a80c
children eb8b35dccd99
line wrap: on
line diff
--- a/src/luan/modules/Utils.java	Mon Jun 17 21:50:40 2019 -0600
+++ b/src/luan/modules/Utils.java	Tue Jun 18 16:27:03 2019 -0600
@@ -93,108 +93,5 @@
 		copyAll(in,out);
 		return out.toByteArray();
 	}
-/*
-	public static boolean exists(File file) {
-		try {
-			return file.exists() && file.getName().equals(file.getCanonicalFile().getName());
-		} catch(IOException e) {
-			throw new RuntimeException(e);
-		}
-	}
-*/
-/*
-	private static File toFile(String path) {
-		if( path.contains("//") )
-			return null;
-		File file = new File(path);
-		return file.exists() ? file : null;
-	}
 
-	private static URL toUrl(String path) {
-		if( path.indexOf(':') == -1 )
-			return null;
-		if( path.startsWith("classpath:") ) {
-			path = path.substring(10);
-			if( path.contains("//") )
-				return null;
-			URL url;
-			if( !path.contains("#") ) {
-				url = ClassLoader.getSystemResource(path);
-			} else {
-				String[] a = path.split("#");
-				url = ClassLoader.getSystemResource(a[0]);
-				if( url==null ) {
-					for( int i=1; i<a.length; i++ ) {
-						url = ClassLoader.getSystemResource(a[0]+"/"+a[i]);
-						if( url != null ) {
-							try {
-								url = new URL(url,".");
-							} catch(MalformedURLException e) {
-								throw new RuntimeException(e);
-							}
-							break;
-						}
-					}
-				}
-			}
-			return url==null ? null : url;
-		}
-		try {
-			return new URL(path);
-		} catch(MalformedURLException e) {}
-		return null;
-	}
-
-	static boolean exists(String path) {
-		return toFile(path)!=null || toUrl(path)!=null;
-	}
-*/
-
-
-
-/*	replace by uri"os:..."
-
-	// process
-
-	public static class ProcessException extends IOException {
-		private ProcessException(String msg) {
-			super(msg);
-		}
-	}
-
-	public static void checkProcess(Process proc)
-		throws IOException
-	{
-		try {
-			proc.waitFor();
-		} catch(InterruptedException e) {
-			throw new RuntimeException(e);
-		}
-		int exitVal = proc.exitValue();
-		if( exitVal != 0 ) {
-			Reader err = new InputStreamReader(proc.getErrorStream());
-			String error = readAll(err);
-			err.close();
-			throw new ProcessException(error);
-		}
-	}
-
-	public static String getOutput(Process proc)
-		throws IOException
-	{
-		Reader in = new InputStreamReader(proc.getInputStream());
-		String s = readAll(in);
-		in.close();
-		return s;
-	}
-
-	public static String execProcess(String... cmd)
-		throws IOException
-	{
-		Process proc = Runtime.getRuntime().exec(cmd);
-		String s = getOutput(proc);
-		checkProcess(proc);
-		return s;
-	}
-*/
 }