@InterfaceAudience.Private public class WrapperAsyncFSOutput extends Object implements AsyncFSOutput
AsyncFSOutput
wraps a FSDataOutputStream
.Constructor and Description |
---|
WrapperAsyncFSOutput(org.apache.hadoop.fs.Path file,
org.apache.hadoop.fs.FSDataOutputStream out) |
Modifier and Type | Method and Description |
---|---|
int |
buffered()
Return the current size of buffered data.
|
void |
close()
Close the file.
|
CompletableFuture<Long> |
flush(boolean sync)
Flush the buffer out.
|
org.apache.hadoop.hdfs.protocol.DatanodeInfo[] |
getPipeline()
Return current pipeline.
|
boolean |
isBroken()
Whether the stream is broken.
|
void |
recoverAndClose(CancelableProgressable reporter)
The close method when error occurred.
|
void |
write(byte[] b)
Just call write(b, 0, b.length).
|
void |
write(byte[] b,
int off,
int len)
Copy the data into the buffer.
|
void |
write(ByteBuffer bb)
Copy the data in the given
bb into the buffer. |
void |
writeInt(int i)
Write an int to the buffer.
|
public WrapperAsyncFSOutput(org.apache.hadoop.fs.Path file, org.apache.hadoop.fs.FSDataOutputStream out)
public void write(byte[] b)
AsyncFSOutput
write
in interface AsyncFSOutput
AsyncFSOutput.write(byte[], int, int)
public void write(byte[] b, int off, int len)
AsyncFSOutput
AsyncFSOutput.flush(boolean)
to flush the
buffer manually.write
in interface AsyncFSOutput
public void writeInt(int i)
AsyncFSOutput
writeInt
in interface AsyncFSOutput
public void write(ByteBuffer bb)
AsyncFSOutput
bb
into the buffer.write
in interface AsyncFSOutput
public int buffered()
AsyncFSOutput
buffered
in interface AsyncFSOutput
public org.apache.hadoop.hdfs.protocol.DatanodeInfo[] getPipeline()
AsyncFSOutput
getPipeline
in interface AsyncFSOutput
public CompletableFuture<Long> flush(boolean sync)
AsyncFSOutput
flush
in interface AsyncFSOutput
sync
- persistent the data to devicepublic void recoverAndClose(CancelableProgressable reporter) throws IOException
AsyncFSOutput
recoverAndClose
in interface AsyncFSOutput
IOException
public void close() throws IOException
AsyncFSOutput
AsyncFSOutput.recoverAndClose(CancelableProgressable)
if this method
throws an exception.close
in interface Closeable
close
in interface AutoCloseable
close
in interface AsyncFSOutput
IOException
public boolean isBroken()
AsyncFSOutput
isBroken
in interface AsyncFSOutput
Copyright © 2007–2019 Cloudera. All rights reserved.