/** * {@inheritDoc} */ public int read(byte[] b) throws IOException { open(); return in.read(b); }
/** * {@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 int read(byte[] b, int off, int len) throws IOException { open(); return in.read(b, off, len); }
/** * {@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 int read() throws IOException { open(); return in.read(); }
@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); } }
/** * {@inheritDoc} */ public int read() throws IOException { open(); return in.read(); }
@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); } }
/** * {@inheritDoc} */ public int read(byte[] b) throws IOException { open(); return in.read(b); }
@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); } }
/** * {@inheritDoc} */ public int read(byte[] b, int off, int len) throws IOException { open(); return in.read(b, off, len); }
/** * {@inheritDoc} */ public int read() throws IOException { open(); return in.read(); }
/** * {@inheritDoc} */ public int read(byte[] b, int off, int len) throws IOException { open(); return in.read(b, off, len); }
/** * {@inheritDoc} */ public int available() throws IOException { open(); return in.available(); }
/** * {@inheritDoc} */ public long skip(long n) throws IOException { open(); return in.skip(n); }
/** * {@inheritDoc} */ public int available() throws IOException { open(); return in.available(); }