/** * {@inheritDoc} */ public InputStream getInputStream(String filePath) throws FileSystemException { File f = new File(root, osPath(filePath)); try { if (monitor == null) { return new LazyFileInputStream(f); } else { return monitor.open(f); } } catch (FileNotFoundException fnfe) { String msg = f.getPath() + " does not denote an existing file"; log.debug(msg); throw new FileSystemException(msg, fnfe); } }
/** * {@inheritDoc} */ public InputStream getInputStream(String filePath) throws FileSystemException { File f = new File(root, osPath(filePath)); try { if (monitor == null) { return new LazyFileInputStream(f); } else { return monitor.open(f); } } catch (FileNotFoundException fnfe) { String msg = f.getPath() + " does not denote an existing file"; log.debug(msg); throw new FileSystemException(msg, fnfe); } }
/** * {@inheritDoc} */ public InputStream getInputStream(String filePath) throws FileSystemException { File f = new File(root, osPath(filePath)); try { if (monitor == null) { return new LazyFileInputStream(f); } else { return monitor.open(f); } } catch (FileNotFoundException fnfe) { String msg = f.getPath() + " does not denote an existing file"; log.debug(msg); throw new FileSystemException(msg, fnfe); } }
@Override public InputStream getStream() throws DataStoreException { File cached = null; // Need a catch as there's a possibility of eviction of this from cache try { cached = store.cache.get(getIdentifier().toString()); } catch (final Exception e) { LOG.debug("Error retrieving from cache " + getIdentifier(), e); } try { // If cache configured to 0 will return null if (cached == null || !cached.exists()) { InputStream in = null; try { TransientFileFactory fileFactory = TransientFileFactory.getInstance(); File tmpFile = fileFactory.createTransientFile("temp0cache", null, temp); in = backend.getRecord(getIdentifier()).getStream(); copyInputStreamToFile(in, tmpFile); return new LazyFileInputStream(tmpFile); } finally { Closeables.close(in, false); } } else { return new FileInputStream(cached); } } catch (final Exception e) { throw new DataStoreException( "Error opening input stream for identifier " + getIdentifier(), e); } }
@Override public InputStream getStream() throws DataStoreException { File cached = null; // Need a catch as there's a possibility of eviction of this from cache try { cached = store.cache.get(getIdentifier().toString()); } catch (final Exception e) { LOG.debug("Error retrieving from cache " + getIdentifier(), e); } try { // If cache configured to 0 will return null if (cached == null || !cached.exists()) { InputStream in = null; try { TransientFileFactory fileFactory = TransientFileFactory.getInstance(); File tmpFile = fileFactory.createTransientFile("temp0cache", null, temp); in = backend.getRecord(getIdentifier()).getStream(); copyInputStreamToFile(in, tmpFile); return new LazyFileInputStream(tmpFile); } finally { Closeables.close(in, false); } } else { return new FileInputStream(cached); } } catch (final Exception e) { throw new DataStoreException( "Error opening input stream for identifier " + getIdentifier(), e); } }
@Override public InputStream getStream() throws DataStoreException { File cached = null; // Need a catch as there's a possibility of eviction of this from cache try { cached = store.cache.get(getIdentifier().toString()); } catch (final Exception e) { LOG.debug("Error retrieving from cache " + getIdentifier(), e); } try { // If cache configured to 0 will return null if (cached == null || !cached.exists()) { InputStream in = null; try { TransientFileFactory fileFactory = TransientFileFactory.getInstance(); File tmpFile = fileFactory.createTransientFile("temp0cache", null, temp); in = backend.getRecord(getIdentifier()).getStream(); copyInputStreamToFile(in, tmpFile); return new LazyFileInputStream(tmpFile); } finally { Closeables.close(in, false); } } else { return new FileInputStream(cached); } } catch (final Exception e) { throw new DataStoreException( "Error opening input stream for identifier " + getIdentifier(), e); } }