org.apache.hadoop.hdfs.client
Class HdfsDataOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by java.io.FilterOutputStream
          extended by java.io.DataOutputStream
              extended by org.apache.hadoop.fs.FSDataOutputStream
                  extended by org.apache.hadoop.hdfs.client.HdfsDataOutputStream
All Implemented Interfaces:
Closeable, DataOutput, Flushable, org.apache.hadoop.fs.Syncable

@InterfaceAudience.Public
@InterfaceStability.Evolving
public class HdfsDataOutputStream
extends org.apache.hadoop.fs.FSDataOutputStream

The Hdfs implementation of FSDataOutputStream.


Nested Class Summary
static class HdfsDataOutputStream.SyncFlag
           
 
Field Summary
 
Fields inherited from class java.io.DataOutputStream
written
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
HdfsDataOutputStream(org.apache.hadoop.hdfs.DFSOutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats)
           
HdfsDataOutputStream(org.apache.hadoop.hdfs.DFSOutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats, long startPosition)
           
 
Method Summary
 int getCurrentBlockReplication()
          Get the actual number of replicas of the current block.
 void hsync(EnumSet<HdfsDataOutputStream.SyncFlag> syncFlags)
          Sync buffered data to DataNodes (flush to disk devices).
 
Methods inherited from class org.apache.hadoop.fs.FSDataOutputStream
close, getPos, hflush, hsync, sync
 
Methods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
 
Methods inherited from class java.io.FilterOutputStream
write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.io.DataOutput
write
 

Constructor Detail

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
Method Detail

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:
FSDataOutputStream.hsync()


Copyright © 2013 Apache Software Foundation. All Rights Reserved.