org.apache.hadoop.hdfs.client
Class HdfsDataOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.io.DataOutputStream
org.apache.hadoop.fs.FSDataOutputStream
org.apache.hadoop.hdfs.client.HdfsDataOutputStream
- All Implemented Interfaces:
- Closeable, DataOutput, Flushable, org.apache.hadoop.fs.CanSetDropBehind, org.apache.hadoop.fs.Syncable
@InterfaceAudience.Public
@InterfaceStability.Evolving
public class HdfsDataOutputStream
- extends org.apache.hadoop.fs.FSDataOutputStream
The Hdfs implementation of FSDataOutputStream
.
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)
|
Methods inherited from class org.apache.hadoop.fs.FSDataOutputStream |
close, getPos, hflush, hsync, setDropBehind, 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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
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
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 © 2014 Apache Software Foundation. All Rights Reserved.