本文整理汇总了Java中org.apache.hadoop.fs.Options.CreateOpts.Progress方法的典型用法代码示例。如果您正苦于以下问题:Java CreateOpts.Progress方法的具体用法?Java CreateOpts.Progress怎么用?Java CreateOpts.Progress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.fs.Options.CreateOpts
的用法示例。
在下文中一共展示了CreateOpts.Progress方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.apache.hadoop.fs.Options.CreateOpts; //导入方法依赖的package包/类
@Override
public FSDataOutputStream create(Path f, EnumSet<CreateFlag> createFlag,
CreateOpts... opts) throws AccessControlException,
FileAlreadyExistsException, FileNotFoundException,
ParentNotDirectoryException, UnsupportedFileSystemException, IOException {
// Need to translate the FileContext-style options into FileSystem-style
// Permissions with umask
CreateOpts.Perms permOpt = CreateOpts.getOpt(
CreateOpts.Perms.class, opts);
FsPermission umask = FsPermission.getUMask(fs.getConf());
FsPermission permission = (permOpt != null) ? permOpt.getValue()
: FsPermission.getFileDefault().applyUMask(umask);
permission = permission.applyUMask(umask);
// Overwrite
boolean overwrite = createFlag.contains(CreateFlag.OVERWRITE);
// bufferSize
int bufferSize = fs.getConf().getInt(
CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY,
CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_DEFAULT);
CreateOpts.BufferSize bufOpt = CreateOpts.getOpt(
CreateOpts.BufferSize.class, opts);
bufferSize = (bufOpt != null) ? bufOpt.getValue() : bufferSize;
// replication
short replication = fs.getDefaultReplication(f);
CreateOpts.ReplicationFactor repOpt =
CreateOpts.getOpt(CreateOpts.ReplicationFactor.class, opts);
replication = (repOpt != null) ? repOpt.getValue() : replication;
// blockSize
long blockSize = fs.getDefaultBlockSize(f);
CreateOpts.BlockSize blockOpt = CreateOpts.getOpt(
CreateOpts.BlockSize.class, opts);
blockSize = (blockOpt != null) ? blockOpt.getValue() : blockSize;
// Progressable
Progressable progress = null;
CreateOpts.Progress progressOpt = CreateOpts.getOpt(
CreateOpts.Progress.class, opts);
progress = (progressOpt != null) ? progressOpt.getValue() : progress;
return fs.create(f, permission, overwrite, bufferSize, replication,
blockSize, progress);
}
示例2: create
import org.apache.hadoop.fs.Options.CreateOpts; //导入方法依赖的package包/类
@Override
public FSDataOutputStream create(Path f, EnumSet<CreateFlag> createFlag,
CreateOpts... opts) throws AccessControlException,
FileAlreadyExistsException, FileNotFoundException,
ParentNotDirectoryException, UnsupportedFileSystemException, IOException {
// Need to translate the FileContext-style options into FileSystem-style
// Permissions with umask
CreateOpts.Perms permOpt = (CreateOpts.Perms) CreateOpts.getOpt(
CreateOpts.Perms.class, opts);
FsPermission umask = FsPermission.getUMask(fs.getConf());
FsPermission permission = (permOpt != null) ? permOpt.getValue()
: FsPermission.getFileDefault().applyUMask(umask);
permission = permission.applyUMask(umask);
// Overwrite
boolean overwrite = createFlag.contains(CreateFlag.OVERWRITE);
// bufferSize
int bufferSize = fs.getConf().getInt(
CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_KEY,
CommonConfigurationKeysPublic.IO_FILE_BUFFER_SIZE_DEFAULT);
CreateOpts.BufferSize bufOpt = (CreateOpts.BufferSize) CreateOpts.getOpt(
CreateOpts.BufferSize.class, opts);
bufferSize = (bufOpt != null) ? bufOpt.getValue() : bufferSize;
// replication
short replication = fs.getDefaultReplication(f);
CreateOpts.ReplicationFactor repOpt =
(CreateOpts.ReplicationFactor) CreateOpts.getOpt(
CreateOpts.ReplicationFactor.class, opts);
replication = (repOpt != null) ? repOpt.getValue() : replication;
// blockSize
long blockSize = fs.getDefaultBlockSize(f);
CreateOpts.BlockSize blockOpt = (CreateOpts.BlockSize) CreateOpts.getOpt(
CreateOpts.BlockSize.class, opts);
blockSize = (blockOpt != null) ? blockOpt.getValue() : blockSize;
// Progressable
Progressable progress = null;
CreateOpts.Progress progressOpt = (CreateOpts.Progress) CreateOpts.getOpt(
CreateOpts.Progress.class, opts);
progress = (progressOpt != null) ? progressOpt.getValue() : progress;
return fs.create(f, permission, overwrite, bufferSize, replication,
blockSize, progress);
}