Interface AsyncFSOutput
- All Superinterfaces:
AutoCloseable
,Closeable
- All Known Implementing Classes:
FanOutOneBlockAsyncDFSOutput
,WrapperAsyncFSOutput
Interface for asynchronous filesystem output stream.
The implementation is not required to be thread safe.
-
Method Summary
Modifier and TypeMethodDescriptionint
buffered()
Return the current size of buffered data.void
close()
Close the file.flush
(boolean sync) Flush the buffer out.org.apache.hadoop.hdfs.protocol.DatanodeInfo[]
Return current pipeline.long
Returns byteSize success synced to underlying filesystem.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 givenbb
into the buffer.void
writeInt
(int i) Write an int to the buffer.
-
Method Details
-
write
Just call write(b, 0, b.length).- See Also:
-
write
Copy the data into the buffer. Note that you need to callflush(boolean)
to flush the buffer manually. -
writeInt
Write an int to the buffer. -
write
Copy the data in the givenbb
into the buffer. -
buffered
int buffered()Return the current size of buffered data. -
isBroken
boolean isBroken()Whether the stream is broken. -
getPipeline
org.apache.hadoop.hdfs.protocol.DatanodeInfo[] getPipeline()Return current pipeline. Empty array if no pipeline. -
flush
Flush the buffer out.- Parameters:
sync
- persistent the data to device- Returns:
- A CompletableFuture that hold the acked length after flushing.
-
recoverAndClose
The close method when error occurred.- Throws:
IOException
-
close
Close the file. You should callrecoverAndClose(CancelableProgressable)
if this method throws an exception.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
getSyncedLength
long getSyncedLength()Returns byteSize success synced to underlying filesystem.
-