Package 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,AutoCloseable,Abortable,CanSetDropBehind,org.apache.hadoop.fs.statistics.IOStatisticsSource,StreamCapabilities,Syncable
The Hdfs implementation of
FSDataOutputStream.-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.hadoop.fs.Abortable
org.apache.hadoop.fs.Abortable.AbortableResultNested classes/interfaces inherited from interface org.apache.hadoop.fs.StreamCapabilities
StreamCapabilities.StreamCapability -
Field Summary
Fields inherited from class java.io.DataOutputStream
writtenFields inherited from class java.io.FilterOutputStream
outFields inherited from interface org.apache.hadoop.fs.StreamCapabilities
ABORTABLE_STREAM, DROPBEHIND, HFLUSH, HSYNC, IOSTATISTICS, IOSTATISTICS_CONTEXT, PREADBYTEBUFFER, READAHEAD, READBYTEBUFFER, UNBUFFER, VECTOREDIO, VECTOREDIO_BUFFERS_SLICED -
Constructor Summary
ConstructorsConstructorDescriptionHdfsDataOutputStream(org.apache.hadoop.crypto.CryptoOutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats) HdfsDataOutputStream(org.apache.hadoop.crypto.CryptoOutputStream out, org.apache.hadoop.fs.FileSystem.Statistics stats, long startPosition) 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
Modifier and TypeMethodDescriptionintGet the actual number of replicas of the current block.voidhsync(EnumSet<HdfsDataOutputStream.SyncFlag> syncFlags) Sync buffered data to DataNodes (flush to disk devices).Methods inherited from class org.apache.hadoop.fs.FSDataOutputStream
abort, close, getIOStatistics, getPos, getWrappedStream, hasCapability, hflush, hsync, setDropBehind, toStringMethods inherited from class java.io.DataOutputStream
flush, size, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTFMethods inherited from class java.io.FilterOutputStream
writeMethods inherited from class java.io.OutputStream
nullOutputStreamMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.io.DataOutput
write
-
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
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
Sync buffered data to DataNodes (flush to disk devices).- Parameters:
syncFlags- Indicate the detailed semantic and actions of the hsync.- Throws:
IOException- See Also:
-