@Override public FSDataInputStream open(Path f, int bufferSize) throws IOException { if (LOG.isDebugEnabled()) { LOG.debug("Opening file: " + f.toString()); } Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); FileMetadata meta = store.retrieveMetadata(key); if (meta == null) { throw new FileNotFoundException(f.toString()); } if (meta.isDir()) { throw new FileNotFoundException(f.toString() + " is a directory not a file."); } return new FSDataInputStream(new BufferedFSInputStream( new NativeAzureFsInputStream(store.retrieve(key), key, meta.getLength()), bufferSize)); }
@Override public FSDataInputStream open(Path f, int bufferSize) throws IOException { LOG.debug("Opening file: {}", f.toString()); Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); FileMetadata meta = store.retrieveMetadata(key); if (meta == null) { throw new FileNotFoundException(f.toString()); } if (meta.isDir()) { throw new FileNotFoundException(f.toString() + " is a directory not a file."); } return new FSDataInputStream(new BufferedFSInputStream( new NativeAzureFsInputStream(store.retrieve(key), key, meta.getLength()), bufferSize)); }
@Override public FSDataInputStream open(Path f, int bufferSize) throws IOException { FileStatus fs = getFileStatus(f); // will throw if the file doesn't exist if (fs.isDirectory()) { throw new FileNotFoundException("'" + f + "' is a directory"); } LOG.info("Opening '" + f + "' for reading"); Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); return new FSDataInputStream(new BufferedFSInputStream( new NativeS3FsInputStream(store, statistics, store.retrieve(key), key), bufferSize)); }
@Override public FSDataInputStream open(Path f, int bufferSize) throws IOException { if (!exists(f)) { throw new FileNotFoundException(f.toString()); } Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); return new FSDataInputStream(new BufferedFSInputStream( new NativeS3FsInputStream(store.retrieve(key), key), bufferSize)); }
@Override public FSDataInputStream open(Path path, int bufferSize) throws IOException { SftpGetMonitor monitor = new SftpGetMonitor(); try { ChannelSftp channelSftp = fsHelper.getSftpChannel(); InputStream is = channelSftp.get(path.toString(), monitor); return new FSDataInputStream(new BufferedFSInputStream(new SftpFsFileInputStream(is, channelSftp), bufferSize)); } catch (SftpException e) { throw new IOException(e); } }
@Override public FSDataInputStream open(Path f, int bufferSize) throws IOException { FileStatus fs = getFileStatus(f); // will throw if the file doesn't exist if (fs.isDirectory()) { throw new IOException("'" + f + "' is a directory"); } LOG.info("Opening '" + f + "' for reading"); Path absolutePath = makeAbsolute(f); String key = pathToKey(absolutePath); return new FSDataInputStream(new BufferedFSInputStream( new NativeS3FsInputStream(store, statistics, store.retrieve(key), key), bufferSize)); }
@Override public FSDataInputStream open(Path path, int bufferSize) throws IOException { return new FSDataInputStream( new BufferedFSInputStream( new PrestoS3InputStream(s3, uri.getHost(), path, maxAttempts, maxBackoffTime, maxRetryTime), bufferSize)); }
@Override public FSDataInputStream open(Path path, int bufferSize) throws IOException { SftpGetMonitor monitor = new SftpGetMonitor(); try { ChannelSftp channelSftp = this.fsHelper.getSftpChannel(); InputStream is = channelSftp.get(HadoopUtils.toUriPath(path), monitor); return new FSDataInputStream(new BufferedFSInputStream(new SftpFsHelper.SftpFsFileInputStream(is, channelSftp), bufferSize)); } catch (SftpException e) { throw new IOException(e); } }
@Override @Nonnull public FSDataInputStream open(Path path, int bufferSize) throws IOException { path = checkNotNull(path); FileStatus fs = getFileStatus(path); // will throw if the file doesn't exist if (fs.isDirectory()) throw new FileNotFoundException("'" + path + "' is a directory"); LOG.info("Opening '{}' for reading", path); Path absolutePath = makeAbsolute(path); String key = pathToKey(absolutePath); return new FSDataInputStream(new BufferedFSInputStream(new OSSFileInputStream(store, key, of(statistics)), bufferSize)); }
@Override public FSDataInputStream open(Path f, int bufferSize) throws IOException { Path baseTarPath = getBaseTarPath(f); String inFile = getFileInArchive(f); if (inFile == null) throw new IOException("TAR FileSystem: Can not open the whole TAR"); // adjust for the header long offset = index.getOffset(inFile); long size = index.getSize(inFile); FSDataInputStream in = underlyingFS.open(baseTarPath); in.seek(offset - 512); TarArchiveEntry entry = readHeaderEntry(in); if (!entry.getName().equals(inFile)) { LOG.fatal( "Index file is corrupt." + "Requested filename is present in index " + "but absent in TAR."); throw new IOException("Requested filename does not match "); } return new FSDataInputStream( new BufferedFSInputStream( new SeekableTarInputStream(in, size, offset), bufferSize)); }
@Override public FSDataInputStream open(Path path, int bufferSize) throws IOException { if (!exists(path)) { throw new FileNotFoundException(path.toString()); } return new FSDataInputStream(new BufferedFSInputStream( new LFSInputStream(path), bufferSize)); }