1 package hudson.remoting; 2 3 import java.io.InputStream ; 4 import java.io.ByteArrayOutputStream ; 5 6 11 public class TestCallable implements Callable { 12 public Object call() throws Throwable { 13 Object [] r = new Object [4]; 14 15 r[0] = getClass().getClassLoader().toString(); 17 18 String resName = "TestCallable.class"; 20 InputStream in = getClass().getResourceAsStream(resName); 21 ByteArrayOutputStream baos = new ByteArrayOutputStream (); 22 23 byte[] buf = new byte[8192]; 24 int len; 25 while((len=in.read(buf))>0) 26 baos.write(buf,0,len); 27 in.close(); 28 29 r[1] = baos.toByteArray(); 30 31 r[2] = getClass().getResource(resName); 33 r[3] = getClass().getResource(resName); 34 35 return r; 36 } 37 38 } 39 | Popular Tags |