@InterfaceAudience.Private public class DFSOutputStream extends FSOutputSummer implements Syncable, CanSetDropBehind
Modifier and Type | Method and Description |
---|---|
protected void |
checkClosed()
Check if the implementing OutputStream is closed and should no longer
accept writes.
|
void |
close()
Closes this output stream and releases any system
resources associated with this stream.
|
int |
getCurrentBlockReplication()
Note that this is not a public API;
use
HdfsDataOutputStream.getCurrentBlockReplication() instead. |
int |
getNumCurrentReplicas()
Deprecated.
|
DatanodeInfo[] |
getPipeline() |
void |
hflush()
Flushes out to all replicas of the block.
|
void |
hsync()
Similar to posix fsync, flush out the data in client's user buffer
all the way to the disk device (but the disk may have it in its cache).
|
void |
hsync(EnumSet<HdfsDataOutputStream.SyncFlag> syncFlags)
The expected semantics is all data have flushed out to all replicas
and all replicas have done posix fsync equivalent - ie the OS has
flushed it to the disk device (but the disk may have it in its cache).
|
void |
setArtificialSlowdown(long period) |
void |
setChunksPerPacket(int value) |
void |
setDropBehind(Boolean dropBehind)
Configure whether the stream should drop the cache.
|
void |
sync()
Deprecated.
|
protected void |
writeChunk(byte[] b,
int offset,
int len,
byte[] checksum) |
convertToByteStream, flushBuffer, flushBuffer, getBufferedDataSize, resetChecksumChunk, write, write
flush, write
protected void checkClosed() throws IOException
FSOutputSummer
IOException
if it is closed.checkClosed
in class FSOutputSummer
IOException
- if this stream is already closed.public DatanodeInfo[] getPipeline()
protected void writeChunk(byte[] b, int offset, int len, byte[] checksum) throws IOException
writeChunk
in class FSOutputSummer
IOException
@Deprecated public void sync() throws IOException
sync
in interface Syncable
IOException
Syncable.hflush()
public void hflush() throws IOException
hflush
in interface Syncable
IOException
- if any error occurspublic void hsync() throws IOException
Syncable
hsync
in interface Syncable
IOException
- if error occurspublic void hsync(EnumSet<HdfsDataOutputStream.SyncFlag> syncFlags) throws IOException
CreateFlag.SYNC_BLOCK
.syncFlags
- Indicate the semantic of the sync. Currently used to specify
whether or not to update the block length in NameNode.IOException
@Deprecated public int getNumCurrentReplicas() throws IOException
HdfsDataOutputStream.getCurrentBlockReplication()
.IOException
public int getCurrentBlockReplication() throws IOException
HdfsDataOutputStream.getCurrentBlockReplication()
instead.IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public void setArtificialSlowdown(long period)
public void setChunksPerPacket(int value)
public void setDropBehind(Boolean dropBehind) throws IOException
CanSetDropBehind
setDropBehind
in interface CanSetDropBehind
dropBehind
- Whether to drop the cache. null means to use the
default value.IOException
- If there was an error changing the dropBehind
setting.
UnsupportedOperationException If this stream doesn't support
setting the drop-behind.Copyright © 2013 Apache Software Foundation. All rights reserved.