org.apache.hadoop.hdfs

## Class DistributedFileSystem.HdfsDataOutputStreamBuilder

- java.lang.Object
- - org.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>
  - - org.apache.hadoop.hdfs.DistributedFileSystem.HdfsDataOutputStreamBuilder

- Enclosing class:
    org.apache.hadoop.hdfs.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.

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and 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()`
    `protected 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` | `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` | `syncBlock()` Force closed blocks to disk.

    - ### Methods inherited from class org.apache.hadoop.fs.FSDataOutputStreamBuilder

      `append, blockSize, bufferSize, checksumOpt, create, getBlockSize, getBufferSize, getChecksumOpt, getFS, getMandatoryKeys, getOptions, getPath, getPermission, getProgress, getReplication, isRecursive, must, must, must, must, must, must, opt, opt, opt, opt, opt, opt, overwrite, permission, progress, recursive, replication`

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

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

- - ### Method Detail

    - #### getThisBuilder

          protected 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.`

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

          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 class `org.apache.hadoop.fs.FSDataOutputStreamBuilder<org.apache.hadoop.fs.FSDataOutputStream,DistributedFileSystem.HdfsDataOutputStreamBuilder>`
      Returns:
        a fully-initialized OutputStream.
      Throws:
        `IOException` - on I/O errors.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.