Class HdfsDataOutputStream

All Implemented Interfaces:
Closeable, DataOutput, Flushable, AutoCloseable, Abortable, CanSetDropBehind, org.apache.hadoop.fs.statistics.IOStatisticsSource, StreamCapabilities, Syncable

@Public @Evolving public class HdfsDataOutputStream extends FSDataOutputStream
The Hdfs implementation of FSDataOutputStream.
  • Constructor Details

    • HdfsDataOutputStream

      public HdfsDataOutputStream(org.apache.hadoop.hdfs.DFSOutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats, long startPosition) throws IOException
      Throws:
      IOException
    • HdfsDataOutputStream

      public HdfsDataOutputStream(org.apache.hadoop.hdfs.DFSOutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats) throws IOException
      Throws:
      IOException
    • HdfsDataOutputStream

      public HdfsDataOutputStream(org.apache.hadoop.crypto.CryptoOutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats, long startPosition) throws IOException
      Throws:
      IOException
    • HdfsDataOutputStream

      public HdfsDataOutputStream(org.apache.hadoop.crypto.CryptoOutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats) throws IOException
      Throws:
      IOException
  • Method Details

    • getCurrentBlockReplication

      public int getCurrentBlockReplication() throws IOException
      Get the actual number of replicas of the current block. This can be different from the designated replication factor of the file because the namenode does not maintain replication for the blocks which are currently being written to. Depending on the configuration, the client may continue to write to a block even if a few datanodes in the write pipeline have failed, or the client may add a new datanodes once a datanode has failed.
      Returns:
      the number of valid replicas of the current block
      Throws:
      IOException
    • hsync

      public void hsync(EnumSet<HdfsDataOutputStream.SyncFlag> syncFlags) throws IOException
      Sync buffered data to DataNodes (flush to disk devices).
      Parameters:
      syncFlags - Indicate the detailed semantic and actions of the hsync.
      Throws:
      IOException
      See Also: