comparison core/src/luan/modules/Utils.java @ 251:705d14f4d8ee

start web testing git-svn-id: https://luan-java.googlecode.com/svn/trunk@252 21e917c8-12df-6dd8-5cb6-c86387c605b9
author fschmidt@gmail.com <fschmidt@gmail.com@21e917c8-12df-6dd8-5cb6-c86387c605b9>
date Sun, 19 Oct 2014 03:38:47 +0000
parents 97d175772fed
children 4dfa86dbca45
comparison
equal deleted inserted replaced
250:2b6f51d7af40 251:705d14f4d8ee
8 import java.io.File; 8 import java.io.File;
9 import java.net.URL; 9 import java.net.URL;
10 import java.net.MalformedURLException; 10 import java.net.MalformedURLException;
11 import luan.LuanState; 11 import luan.LuanState;
12 import luan.LuanException; 12 import luan.LuanException;
13 import luan.LuanTable;
13 14
14 15
15 public final class Utils { 16 public final class Utils {
16 private Utils() {} // never 17 private Utils() {} // never
17 18
18 static final int bufSize = 8192; 19 static final int bufSize = 8192;
19 20
20 public static void checkNotNull(LuanState luan,Object v,String expected) throws LuanException { 21 private static void checkNotNull(LuanState luan,Object v,String expected) throws LuanException {
21 if( v == null ) 22 if( v == null )
22 throw luan.exception("bad argument #1 ("+expected+" expected, got nil)"); 23 throw luan.exception("bad argument #1 ("+expected+" expected, got nil)");
24 }
25
26 public static void checkNotNull(LuanState luan,String s) throws LuanException {
27 checkNotNull(luan,s,"string");
28 }
29
30 public static void checkNotNull(LuanState luan,LuanTable t) throws LuanException {
31 checkNotNull(luan,t,"table");
32 }
33
34 public static void checkNotNull(LuanState luan,Number n) throws LuanException {
35 checkNotNull(luan,n,"number");
23 } 36 }
24 37
25 public static String readAll(Reader in) 38 public static String readAll(Reader in)
26 throws IOException 39 throws IOException
27 { 40 {