Package org.apache.hadoop.hdfs
Class DistributedFileSystem.HdfsDataOutputStreamBuilder
java.lang.Object
org.apache.hadoop.fs.impl.AbstractFSBuilderImpl<S,B>
org.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>
org.apache.hadoop.hdfs.DistributedFileSystem.HdfsDataOutputStreamBuilder
- All Implemented Interfaces:
org.apache.hadoop.fs.FSBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>
- Enclosing class:
- DistributedFileSystem
public static final class DistributedFileSystem.HdfsDataOutputStreamBuilder
extends org.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>
HdfsDataOutputStreamBuilder provides the HDFS-specific capabilities to
write file on HDFS.
-
Field Summary
Fields inherited from class org.apache.hadoop.fs.impl.AbstractFSBuilderImpl
UNKNOWN_MANDATORY_KEY -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.hadoop.fs.FSDataOutputStreambuild()Build HdfsDataOutputStream to write.ecPolicyName(String policyName) Enforce the file to be a striped file with erasure coding policy 'policyName', no matter what its parent directory's replication or erasure coding policy is.favoredNodes(InetSocketAddress[] nodes) Set favored DataNodes.protected EnumSet<org.apache.hadoop.fs.CreateFlag>getFlags()Advise that the first block replica be written without regard to the client locality.Create the block on transient storage if possible.newBlock()Append data to a new block instead of the end of the last partial block.Advise that a block replica NOT be written to the local rack DataNode.Advise that a block replica NOT be written to the local DataNode.Enforce the file to be a replicated file, no matter what its parent directory's replication or erasure coding policy is.storagePolicyName(String policyName) Enforce a file to follow the specified storage policy irrespective of the storage policy of its parent directory.Force closed blocks to disk.Methods inherited from class org.apache.hadoop.fs.FSDataOutputStreamBuilder
append, blockSize, bufferSize, checksumOpt, create, getBlockSize, getBufferSize, getChecksumOpt, getFS, getPermission, getProgress, getReplication, isRecursive, overwrite, permission, progress, recursive, replicationMethods inherited from class org.apache.hadoop.fs.impl.AbstractFSBuilderImpl
getMandatoryKeys, getOptionalKeys, getOptionalPath, getOptionalPathHandle, getOptions, getPath, getPathHandle, must, must, must, must, must, must, must, mustDouble, mustLong, opt, opt, opt, opt, opt, opt, opt, optDouble, optLong, rejectUnknownMandatoryKeys, rejectUnknownMandatoryKeys
-
Method Details
-
getThisBuilder
- Specified by:
getThisBuilderin classorg.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>
-
favoredNodes
public DistributedFileSystem.HdfsDataOutputStreamBuilder favoredNodes(@Nonnull InetSocketAddress[] nodes) Set favored DataNodes.- Parameters:
nodes- the addresses of the favored DataNodes.
-
syncBlock
Force closed blocks to disk.- See Also:
-
for the details.
-
lazyPersist
Create the block on transient storage if possible.- See Also:
-
for the details.
-
newBlock
Append data to a new block instead of the end of the last partial block.- See Also:
-
for the details.
-
noLocalWrite
Advise that a block replica NOT be written to the local DataNode.- See Also:
-
for the details.
-
noLocalRack
Advise that a block replica NOT be written to the local rack DataNode.- See Also:
-
for the details.
-
storagePolicyName
public DistributedFileSystem.HdfsDataOutputStreamBuilder storagePolicyName(@Nonnull String policyName) Enforce a file to follow the specified storage policy irrespective of the storage policy of its parent directory. -
ecPolicyName
Enforce the file to be a striped file with erasure coding policy 'policyName', no matter what its parent directory's replication or erasure coding policy is. Don't call this function and enforceReplicate() in the same builder since they have conflict of interest. -
replicate
Enforce the file to be a replicated file, no matter what its parent directory's replication or erasure coding policy is. Don't call this function and setEcPolicyName() in the same builder since they have conflict of interest. -
ignoreClientLocality
Advise that the first block replica be written without regard to the client locality.- See Also:
-
for the details.
-
getFlags
- Overrides:
getFlagsin classorg.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>
-
build
Build HdfsDataOutputStream to write.- Specified by:
buildin interfaceorg.apache.hadoop.fs.FSBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder> - Specified by:
buildin classorg.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder> - Returns:
- a fully-initialized OutputStream.
- Throws:
IOException- on I/O errors.
-