@Override public OutputStream openOutputStream() throws IOException { final FileSystem fs = path.getFileSystem(config); return fs.create(path, overwrite); }
@Override public InputStream openInputStream() throws IOException { final FileSystem fs = path.getFileSystem(config); return fs.open(path); }
@Override public long getModTime() throws IOException { if (_modTime == null) { FileSystem fs = _path.getFileSystem(_hadoopConf); _modTime = fs.getFileStatus(_path).getModificationTime(); } return _modTime; }
/** * Returns the Path where the YARN application files should be uploaded to. * * @param appId YARN application id */ private Path getYarnFilesDir(final ApplicationId appId) throws IOException { final FileSystem fileSystem = FileSystem.get(yarnConfiguration); final Path homeDir = fileSystem.getHomeDirectory(); return new Path(homeDir, ".flink/" + appId + '/'); }
protected int updateBlobReplication(String key, int replication) throws IOException { Path path = getKeyDir(key); Path dest = new Path(path, BLOBSTORE_DATA); _fs.setReplication(dest, (short) replication); return _fs.getFileStatus(dest).getReplication(); }
private void deleteSchemaFile(String type, Path metadataDirectory) { try { if (!metadataFileSystem.delete(new Path(metadataDirectory, PRESTO_SCHEMA_FILE_NAME), false)) { throw new PrestoException(HIVE_METASTORE_ERROR, "Could not delete " + type + " schema"); } } catch (IOException e) { throw new PrestoException(HIVE_METASTORE_ERROR, "Could not delete " + type + " schema", e); } }
@Override public void close(boolean abort) throws IOException { recordWriter.close(abort); if (!abort) { length = target.getFileSystem(conf).getFileStatus(target).getLen(); } } };
@Override public String getName() { return path.getName(); }
@Override public OutputStream openStream() throws IOException { return fs.create(descriptorFile); } }
public FileSystem getFileSystem(String user, Path path, Configuration configuration) throws IOException { return hdfsAuthentication.doAs(user, () -> { FileSystem fileSystem = path.getFileSystem(configuration); fileSystem.setVerifyChecksum(verifyChecksum); return fileSystem; }); }
@Override public void close() throws IOException { inputStream.close(); }
@SuppressWarnings("deprecation") @Override public boolean isDir() { return fileStatus.isDir(); } }
@SuppressWarnings("deprecation") @Override public long getDefaultBlockSize() { return this.fs.getDefaultBlockSize(); }
@Override public RemoteIterator<LocatedFileStatus> list(FileSystem fs, Path path) throws IOException { return fs.listLocatedStatus(path); } }
@Override public void close(boolean abort) throws IOException { writer.close(); if (!abort) { length = target.getFileSystem(conf).getFileStatus(target).getLen(); } } };
@Override public long getLastModified() { try { final FileSystem fs = path.getFileSystem(config); return fs.getFileStatus(path).getModificationTime(); } catch (IOException ex) { throw new HdfsIOException(ex); } }
@Override public void close() throws IOException { inputStream.close(); }
@Override public void close() throws IOException { inputStream.close(); }