Mercurial Hosting > luan
comparison core/src/luan/modules/BinaryLuan.java @ 646:cdc70de628b5
simplify LuanException
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 29 Mar 2016 19:58:39 -0600 |
parents | 4723d22062ce |
children |
comparison
equal
deleted
inserted
replaced
645:859c0dedc8b6 | 646:cdc70de628b5 |
---|---|
26 | 26 |
27 static int end(byte[] binary,Integer i,int dflt) { | 27 static int end(byte[] binary,Integer i,int dflt) { |
28 return i==null ? dflt : end(binary,i); | 28 return i==null ? dflt : end(binary,i); |
29 } | 29 } |
30 | 30 |
31 @LuanMethod public static Byte[] byte_(LuanState luan,byte[] binary,Integer i,Integer j) throws LuanException { | 31 @LuanMethod public static Byte[] byte_(byte[] binary,Integer i,Integer j) throws LuanException { |
32 Utils.checkNotNull(luan,binary); | 32 Utils.checkNotNull(binary); |
33 int start = start(binary,i,1); | 33 int start = start(binary,i,1); |
34 int end = end(binary,j,start+1); | 34 int end = end(binary,j,start+1); |
35 Byte[] bytes = new Byte[end-start]; | 35 Byte[] bytes = new Byte[end-start]; |
36 for( int k=0; k<bytes.length; k++ ) { | 36 for( int k=0; k<bytes.length; k++ ) { |
37 bytes[k] = binary[start+k]; | 37 bytes[k] = binary[start+k]; |