diff src/luan/lib/Utils.java @ 125:0cd559a16758

add sockets git-svn-id: https://luan-java.googlecode.com/svn/trunk@126 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Fri, 06 Jun 2014 05:59:11 +0000
parents 1ff1c32417eb
children 0594c132888b
line wrap: on
line diff
--- a/src/luan/lib/Utils.java	Fri Jun 06 03:41:04 2014 +0000
+++ b/src/luan/lib/Utils.java	Fri Jun 06 05:59:11 2014 +0000
@@ -1,22 +1,12 @@
 package luan.lib;
 
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.InputStreamReader;
 import java.io.Reader;
-import java.io.Writer;
 import java.io.IOException;
-import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.net.URL;
 import luan.LuanState;
 import luan.LuanException;
-import luan.LuanElement;
 
 
 public final class Utils {
@@ -41,24 +31,6 @@
 		return buf.toString();
 	}
 
-	public static String read(File file)
-		throws IOException
-	{
-		Reader in = new FileReader(file);
-		String s = readAll(in);
-		in.close();
-		return s;
-	}
-
-	public static String read(URL url)
-		throws IOException
-	{
-		Reader in = new InputStreamReader(url.openStream());
-		String s = readAll(in);
-		in.close();
-		return s;
-	}
-
 	public static void copyAll(InputStream in,OutputStream out)
 		throws IOException
 	{
@@ -69,43 +41,6 @@
 		}
 	}
 
-	public static byte[] readAll(File file)
-		throws IOException
-	{
-		int len = (int)file.length();
-		ByteArrayOutputStream out = new ByteArrayOutputStream(len) {
-			public byte[] toByteArray() {
-				return buf;
-			}
-		};
-		FileInputStream in = new FileInputStream(file);
-		copyAll(in,out);
-		in.close();
-		return out.toByteArray();
-	}
-
-	public static void write(File file,String s)
-		throws IOException
-	{
-		Writer out = new FileWriter(file);
-		out.write(s);
-		out.close();
-	}
-
-	public static void writeAll(byte[] a,OutputStream out)
-		throws IOException
-	{
-		copyAll(new ByteArrayInputStream(a),out);
-	}
-
-	public static void writeAll(File file,byte[] a)
-		throws IOException
-	{
-		FileOutputStream fos = new FileOutputStream(file);
-		writeAll(a,fos);
-		fos.close();
-	}
-
 	public static byte[] readAll(InputStream in)
 		throws IOException
 	{