Gets an input stream for the given file name. @param fname The file name @param jar The JAR, or null @param ctxt The compilation context @return the input stream @throws IOException if an I/O error occurs
(String fname, Jar jar, JspCompilationContext ctxt)
| 706 | * @throws IOException if an I/O error occurs |
| 707 | */ |
| 708 | public static BufferedInputStream getInputStream(String fname, Jar jar, JspCompilationContext ctxt) |
| 709 | throws IOException { |
| 710 | |
| 711 | InputStream in; |
| 712 | |
| 713 | if (jar != null) { |
| 714 | String jarEntryName = fname.substring(1); |
| 715 | in = jar.getInputStream(jarEntryName); |
| 716 | } else { |
| 717 | in = ctxt.getResourceAsStream(fname); |
| 718 | } |
| 719 | |
| 720 | if (in == null) { |
| 721 | throw new FileNotFoundException(Localizer.getMessage("jsp.error.file.not.found", fname)); |
| 722 | } |
| 723 | |
| 724 | return new BufferedInputStream(in, JSP_INPUT_STREAM_BUFFER_SIZE); |
| 725 | } |
| 726 | |
| 727 | /** |
| 728 | * Gets an input source for the given file name. |
no test coverage detected