public InputStream getInputStream() throws IOException { if (resource != null) { InputStream is = resource.openStream(); try { return new LoadServiceResourceInputStream(is); } finally { is.close(); } } byte[] bytes = new byte[(int)path.length()]; ByteBuffer buffer = ByteBuffer.wrap(bytes); FileInputStream fis = new FileInputStream(path); FileChannel fc = fis.getChannel(); fc.read(buffer); fis.close(); return new LoadServiceResourceInputStream(bytes); }
public InputStream getInputStream() throws IOException { if (resource != null) { InputStream is = resource.openStream(); try { return new LoadServiceResourceInputStream(is); } finally { is.close(); } } byte[] bytes = new byte[(int)path.length()]; ByteBuffer buffer = ByteBuffer.wrap(bytes); FileInputStream fis = new FileInputStream(path); FileChannel fc = fis.getChannel(); fc.read(buffer); fis.close(); return new LoadServiceResourceInputStream(bytes); }
public InputStream getInputStream() throws IOException { if (resource != null) { InputStream is = resource.openStream(); try { return new LoadServiceResourceInputStream(is); } finally { is.close(); } } byte[] bytes = new byte[(int)path.length()]; ByteBuffer buffer = ByteBuffer.wrap(bytes); FileInputStream fis = new FileInputStream(path); FileChannel fc = fis.getChannel(); fc.read(buffer); fis.close(); return new LoadServiceResourceInputStream(bytes); }
public InputStream getInputStream() throws IOException { if (resource != null) { InputStream is = resource.openStream(); try { return new LoadServiceResourceInputStream(is); } finally { is.close(); } } byte[] bytes = new byte[(int)path.length()]; ByteBuffer buffer = ByteBuffer.wrap(bytes); FileInputStream fis = new FileInputStream(path); FileChannel fc = fis.getChannel(); fc.read(buffer); fis.close(); return new LoadServiceResourceInputStream(bytes); }
@Override public void load(Ruby runtime, boolean wrap) { InputStream ris = null; try { ris = resource.inputStream(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(scriptName, ris, wrap); } else { runtime.loadFile(scriptName, new LoadServiceResourceInputStream(ris), wrap); } } catch(IOException e) { throw runtime.newLoadError("no such file to load -- " + searchName, searchName); } finally { try { if (ris != null) ris.close(); } catch (IOException ioE) { /* At least we tried.... */} } } }
@Override public void load(Ruby runtime, boolean wrap) { InputStream ris = null; try { ris = resource.inputStream(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(scriptName, ris, wrap); } else { runtime.loadFile(scriptName, new LoadServiceResourceInputStream(ris), wrap); } } catch(IOException e) { throw runtime.newLoadError("no such file to load -- " + searchName, searchName); } finally { try { if (ris != null) ris.close(); } catch (IOException ioE) { /* At least we tried.... */} } } }
public void load(Ruby runtime, boolean wrap) { InputStream in = null; try { in = resource.getInputStream(); String name = resource.getName(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(name, in, wrap); } else { name = CompiledScriptLoader.getFilenameFromPathAndName(resource.getPath(), name, resource.isAbsolute()); runtime.loadFile(name, new LoadServiceResourceInputStream(in), wrap); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } finally { try { in.close(); } catch (Exception ex) {} } }
public void load(Ruby runtime, boolean wrap) { InputStream in = null; try { in = resource.getInputStream(); String name = resource.getName(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(name, in, wrap); } else { name = CompiledScriptLoader.getFilenameFromPathAndName(resource.getPath(), name, resource.isAbsolute()); runtime.loadFile(name, new LoadServiceResourceInputStream(in), wrap); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } finally { try { in.close(); } catch (Exception ex) {} } }