Returns an InputStream for the image described by this FileInfo.
(FileInfo fi)
| 1569 | |
| 1570 | /** Returns an InputStream for the image described by this FileInfo. */ |
| 1571 | InputStream createInputStream(FileInfo fi) throws IOException, MalformedURLException { |
| 1572 | if (fi.inputStream!=null) |
| 1573 | return fi.inputStream; |
| 1574 | else if (fi.url!=null && !fi.url.equals("")) |
| 1575 | return new URL(fi.url+fi.fileName).openStream(); |
| 1576 | else { |
| 1577 | File f = new File(fi.getFilePath()); |
| 1578 | if (f==null || f.isDirectory()) |
| 1579 | return null; |
| 1580 | else { |
| 1581 | InputStream is = new FileInputStream(f); |
| 1582 | if (fi.compression>=FileInfo.LZW || (fi.stripOffsets!=null&&fi.stripOffsets.length>1)) |
| 1583 | is = new RandomAccessStream(is); |
| 1584 | return is; |
| 1585 | } |
| 1586 | } |
| 1587 | } |
| 1588 | |
| 1589 | void openRGB48(ImagePlus imp) { |
| 1590 | isRGB48 = false; |
no test coverage detected