DistributedFileSystem.HdfsDataOutputStreamBuilder (Apache Hadoop HDFS Client 3.5.0 API)
Description: declaration: package: org.apache.hadoop.hdfs, class: DistributedFileSystem, class: HdfsDataOutputStreamBuilder

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 Type
  Method
  Description
  `org.apache.hadoop.fs.FSDataOutputStream`
  `build()`
  Build HdfsDataOutputStream to write.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `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.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `favoredNodes(InetSocketAddress[] nodes)`
  Set favored DataNodes.
  `protected EnumSet<org.apache.hadoop.fs.CreateFlag>`
  `getFlags()`
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `getThisBuilder()`
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `ignoreClientLocality()`
  Advise that the first block replica be written without regard to the client locality.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `lazyPersist()`
  Create the block on transient storage if possible.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `newBlock()`
  Append data to a new block instead of the end of the last partial block.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `noLocalRack()`
  Advise that a block replica NOT be written to the local rack DataNode.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `noLocalWrite()`
  Advise that a block replica NOT be written to the local DataNode.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `replicate()`
  Enforce the file to be a replicated file, no matter what its parent directory's replication or erasure coding policy is.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `storagePolicyName(String policyName)`
  Enforce a file to follow the specified storage policy irrespective of the storage policy of its parent directory.
  `DistributedFileSystem.HdfsDataOutputStreamBuilder`
  `syncBlock()`
  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, replication`

  ### Methods 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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Method Details

  - ### getThisBuilder

    public DistributedFileSystem.HdfsDataOutputStreamBuilder getThisBuilder()
    Specified by:
      `getThisBuilder` in class `org.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

    public DistributedFileSystem.HdfsDataOutputStreamBuilder syncBlock()
    Force closed blocks to disk.
    See Also:
      - `for the details.`

  - ### lazyPersist

    public DistributedFileSystem.HdfsDataOutputStreamBuilder lazyPersist()
    Create the block on transient storage if possible.
    See Also:
      - `for the details.`

  - ### newBlock

    public DistributedFileSystem.HdfsDataOutputStreamBuilder newBlock()
    Append data to a new block instead of the end of the last partial block.
    See Also:
      - `for the details.`

  - ### noLocalWrite

    public DistributedFileSystem.HdfsDataOutputStreamBuilder noLocalWrite()
    Advise that a block replica NOT be written to the local DataNode.
    See Also:
      - `for the details.`

  - ### noLocalRack

    public DistributedFileSystem.HdfsDataOutputStreamBuilder 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

    public DistributedFileSystem.HdfsDataOutputStreamBuilder ecPolicyName(@Nonnull 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. Don't call this function and enforceReplicate() in the same builder since they have conflict of interest.

  - ### replicate

    public DistributedFileSystem.HdfsDataOutputStreamBuilder 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

    public DistributedFileSystem.HdfsDataOutputStreamBuilder ignoreClientLocality()
    Advise that the first block replica be written without regard to the client locality.
    See Also:
      - `for the details.`

  - ### getFlags

    @VisibleForTesting protected EnumSet<org.apache.hadoop.fs.CreateFlag> getFlags()
    Overrides:
      `getFlags` in class `org.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>`

  - ### build

    public org.apache.hadoop.fs.FSDataOutputStream build() throws IOException
    Build HdfsDataOutputStream to write.
    Specified by:
      `build` in interface `org.apache.hadoop.fs.FSBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>`
    Specified by:
      `build` in class `org.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>`
    Returns:
      a fully-initialized OutputStream.
    Throws:
      `IOException` - on I/O errors.